Skip to content

Commit 7c46422

Browse files
committed
feat(flex): add wrap props to flex component
1 parent cb7d77d commit 7c46422

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

res/css/components/views/utils/_Flex.pcss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,5 @@ Please see LICENSE files in the repository root for full details.
1212
align-items: var(--mx-flex-align, unset);
1313
justify-content: var(--mx-flex-justify, unset);
1414
gap: var(--mx-flex-gap, unset);
15+
flex-wrap: var(--mx-flex-wrap, unset);
1516
}

src/components/utils/Flex.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,11 @@ type FlexProps<T extends keyof JSX.IntrinsicElements | JSXElementConstructor<any
3939
* @default start
4040
*/
4141
justify?: "start" | "center" | "end" | "space-between";
42+
/**
43+
* The wrapping of the flex children
44+
* @default nowrap
45+
*/
46+
wrap?: "wrap" | "nowrap" | "wrap-reverse";
4247
/**
4348
* The spacing between the flex children, expressed with the CSS unit
4449
* @default 0
@@ -60,6 +65,7 @@ export function Flex<T extends keyof JSX.IntrinsicElements | JSXElementConstruct
6065
align = "start",
6166
justify = "start",
6267
gap = "0",
68+
wrap = "nowrap",
6369
className,
6470
children,
6571
...props
@@ -71,8 +77,9 @@ export function Flex<T extends keyof JSX.IntrinsicElements | JSXElementConstruct
7177
"--mx-flex-align": align,
7278
"--mx-flex-justify": justify,
7379
"--mx-flex-gap": gap,
80+
"--mx-flex-wrap": wrap,
7481
}),
75-
[align, direction, display, gap, justify],
82+
[align, direction, display, gap, justify, wrap],
7683
);
7784

7885
return React.createElement(as, { ...props, className: classNames("mx_Flex", className), style }, children);

0 commit comments

Comments
 (0)