ant-design/components/flex/index.en-US.md
lijianan 570c1be492
site: add component version to meta (#48226)
* site: add component version to meta

* Update .dumi/theme/builtins/ComponentMeta/index.tsx

Signed-off-by: afc163 <afc163@gmail.com>

---------

Signed-off-by: afc163 <afc163@gmail.com>
Co-authored-by: afc163 <afc163@gmail.com>
2024-04-02 16:33:57 +08:00

2.5 KiB
Raw Blame History

category group title description cover coverDark tag
Components Layout Flex A flex layout container for alignment. https://mdn.alipayobjects.com/huamei_7uahnr/afts/img/A*SMzgSJZE_AwAAAAAAAAAAAAADrJ8AQ/original https://mdn.alipayobjects.com/huamei_7uahnr/afts/img/A*8yArQ43EGccAAAAAAAAAAAAADrJ8AQ/original 5.10.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

Basic align gap Wrap combination debug

API

This component is available since antd@5.10.0. The default behavior of Flex in horizontal mode is to align upward, In vertical mode, aligns the stretch, You can adjust this via properties.

Common props refCommon props

Property Description type Default Version
vertical Is direction of the flex vertical, use flex-direction: column boolean false
wrap Set whether the element is displayed in a single line or in multiple lines reference flex-wrap nowrap
justify Sets the alignment of elements in the direction of the main axis reference justify-content normal
align Sets the alignment of elements in the direction of the cross axis reference align-items normal
flex flex CSS shorthand properties reference flex normal
gap Sets the gap between grids small | middle | large | string | number -
component custom element type React.ComponentType div

Design Token