Skip to main content

Common Examples

import { Flex } from "@servicetitan/anvil2";

const ExampleComponent = () => (
  <Flex direction="column">{/* add content here ... */}</Flex>
);

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.

Best Practices

  • The Layout component should be used to create the overall column structure of a page’s content.
  • Use the Flex component to create CSS Flexbox containers within the page content.
Last modified on January 23, 2026