Skip to main content

Common Examples

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

const ExampleComponent = () => (
  <Grid templateColumns="repeat(3, 1fr)">{/* grid items... */}</Grid>
);

Creating CSS Grid layouts

The Anvil2 Grid component enables building complex layouts using CSS Grid properties. A grid is ultimately an HTML div element with display: grid applied. Use the props listed below to apply other CSS Grid properties to the container.Note that a Grid is always a container, but can also be used as a grid item by wrapping it in another Grid, or even as a flex item if it is a child of a Flex or other element with display: flex.

Using Responsive prop

Grid, like many of our components, have sm, md, lg, xl, and xxl that can be used to control component’s layout properties.Resize window to mobile size to see it in action.

Best Practices

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