- Implementation
- Flex Container Props
- Flex Item Props
- Grid Item Props
- Responsive Flex Props
Usage Guidelines
UseFlex when siblings need to stack or align on one axis inside a section or component. Flex is a CSS Flexbox container for one-dimensional layout. Prefer Layout for the page’s overall columns.Alternatives
- Layout for page-level columns and gutters.
- Grid for two-dimensional tracks,
templateAreas, andGrid.Itemplacement. - Layout utility props on Card (and similar) when the child already accepts
flexandgapand you don’t need a wrapper.
How to Use
ImportFlex and set gap and alignment on the container. Text accepts flexGrow from the layout utilities. grow is the matching prop on Flex when the item is itself a flex container.Flex renders a div with no role. Put interactive controls in the children. order and similar props change visual order only. Assistive technology follows DOM order.Common Examples
Creating Flexbox layouts
The Anvil2Flex component makes it easy to create layouts using CSS Flexbox properties. Under the hood, a flex is just an HTML div element with display: flex applied. Use the props listed below to apply other CSS Flexbox properties to the container.Note that a Flex is always a container, but can also be used as a flex item by wrapping it in another Flex, or a different component that includes display: flex, such as Card, or even as a grid item if it is a child of a Grid or other element with display: grid.