Skip to main content
Props available in Anvil2 components to create and manage layouts using CSS Flexbox and Grid properties.

Layout Props Overview

All Anvil2 components accept a set of props used for adjusting CSS Flexbox and Grid properties by extending the LayoutUtilProps type. Each of these props correspond to a CSS property that is applied to the outermost element rendered by that component. Some of the props are used for Flexbox or Grid containers, and others for items, which need to have a Flex or Grid component as a parent, or another component with display: flex|grid. Note: Some components exclude certain properties (see exceptions below).

Available Props

Exceptions

The following components exclude the flex, flexBasis, and flexGrow props from LayoutUtilProps since the sizing and/or positioning is predetermined:
  • Alert
  • Avatar
  • Badge
  • Chip
  • Icon

Flex and Grid

The Flex and Grid components accept all of the LayoutUtilProps, but without the “flex” or “grid” prefix of a few of the props. For example, flexDirection is just direction on a Flex, and gridTemplateColumns changes to templateColumns on a Grid.

Cards

In Anvil2, Cards are Flexbox containers with no default presets for the Flexbox properties. Similar to Flex, they can use the Flex Container props without adding display: flex in CSS.
Note: Several other components that accept content as children are also Flexbox containers, but usually have a default flexDirection, gap, etc. Card is shown here because adjusting the layout props will be more common in cards than alerts, side navs, or others.

Responsive Layout Props

To enable responsive layout shifts based on preset breakpoints, the following props are also available, which accept objects with the LayoutUtilProps type: Any values passed to regular props (e.g. flexGrow) are applied from the smallest screen size (less than 640px) and larger. When responsive layout props are used, they override the default value at that breakpoint and larger.

Layout Props Examples

Flexbox Example

Grid Example

Last modified on February 19, 2026