Skip to content

Commit 99ce873

Browse files
authored
Merge pull request #2535 from rtturner/flex-derived-styles
Handle derived sx in Flex.tsx
2 parents f86c5c3 + 93ce9f6 commit 99ce873

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

packages/components/src/Flex.tsx

+4-3
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,15 @@ export type FlexProps = BoxProps
1111
*/
1212
export const Flex: ForwardRef<HTMLElement, FlexProps> = React.forwardRef(
1313
function Flex(props: FlexProps, ref) {
14+
const { sx } = props;
1415
return (
1516
<Box
1617
ref={ref}
1718
{...props}
18-
sx={{
19+
sx={theme => ({
1920
display: 'flex',
20-
...props.sx,
21-
}}
21+
...(typeof sx === "function" ? sx(theme) : sx),
22+
})}
2223
/>
2324
)
2425
}

0 commit comments

Comments
 (0)