Skip to main content
For development, import Flex from @servicetitan/anvil2. For design, find it in the Anvil2 file.

Usage Guidelines

Use Flex 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, and Grid.Item placement.
  • Layout utility props on Card (and similar) when the child already accepts flex and gap and you don’t need a wrapper.

How to Use

Import Flex 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 Anvil2 Flex 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.
Last modified on November 13, 2026