Flex
Flex. Available since 0.17.0.
When To Use
- Good for setting spacing between elements.
- Suitable for setting various horizontal and vertical alignments.
Difference with Space component
- Space is used to set the spacing between inline elements. It will add a wrapper element for each child element for inline alignment. Suitable for equidistant arrangement of multiple child elements in rows and columns.
- Flex is used to set the layout of block-level elements. It does not add a wrapper element. Suitable for layout of child elements in vertical or horizontal direction, and provides more flexibility and control.
Examples
Flex API#
| Property | Description | Type | Default Value |
|---|---|---|---|
| Vertical | ParameterIs direction of the flex vertical, use flex-direction: columnUse FlexDirection instead Obsolete Will be removed in a future version. |
Boolean | -- |
| Direction | ParameterSets the direction of the flex, either horizontal or vertical | FlexDirection | -- |
| Wrap | ParameterSet whether the element is displayed in a single line or in multiple lines reference flex-wrap:https://developer.mozilla.org/en-US/docs/Web/CSS/flex-wrap | OneOf<FlexWrap, String> | -- |
| Justify | ParameterSets the alignment of elements in the direction of the main axis reference justify-content https://developer.mozilla.org/en-US/docs/Web/CSS/justify-content | OneOf<FlexJustify, String> | -- |
| Align | ParameterSets the alignment of elements in the direction of the cross axis reference align-items https://developer.mozilla.org/en-US/docs/Web/CSS/align-items | OneOf<FlexAlign, String> | -- |
| FlexCss | Parameterflex CSS shorthand properties reference flex https://developer.mozilla.org/en-US/docs/Web/CSS/flex | String | -- |
| Gap | ParameterSets the gap between grids small | middle | large | string | number | OneOf<FlexGap, String> | -- |
| Component | ParameterCustom element type | String | -- |
| ChildContent | ParameterSet the child element | RenderFragment | -- |
| Id | ParameterID for the component's HTML | String | Uniquely Generated ID |
| Class | ParameterSpecifies one or more class names for an DOM element. | String | -- |
| Style | ParameterSpecifies an inline style for a DOM element. | String | -- |
| RefBack | ParameterA ForwardRef instance. You can get a reference to the internal DOM by using AntDesign.ForwardRef.Current. |
ForwardRef | -- |