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

ContextPropCSS Property
Flex ContainerflexDirectionflex-direction
Flex Itemflexflex
Flex ItemflexGrowflex-grow
Flex ItemflexShrinkflex-shrink
Flex ItemflexBasisflex-basis
Grid ItemgridAreagrid-area
Grid ItemgridColumngrid-column
Grid ItemgridColumnEndgrid-column-end
Grid ItemgridColumnStartgrid-column-start
Grid ItemgridRowgrid-row
Grid ItemgridRowEndgrid-row-end
Grid ItemgridRowStartgrid-row-start
Grid ItemjustifySelfjustify-self
Flex or Grid ContaineralignContentalign-content
Flex or Grid ContaineralignItemsalign-items
Flex or Grid ContainercolumnGapcolumn-gap
Flex or Grid Containergapgap
Flex or Grid ContainerjustifyContentjustify-content
Flex or Grid ContainerjustifyItemsjustify-items
Flex or Grid Containerorderorder
Flex or Grid ContainerplaceContentplace-content
Flex or Grid ContainerplaceItemsplace-items
Flex or Grid ContainerrowGaprow-gap
Flex or Grid ItemalignSelfalign-self
Flex or Grid ItemplaceSelfplace-self

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.
<Card flexDirection="column" alignItems="center">
  <Text>Some text...</Text>
  <Button>Centered Button</Button>
</Card>
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:
PropBreakpoint
sm640px
md768px
lg1024px
xl1280px
xxl1536px
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.
<Button
  // xs and sm screens
  alignSelf="center"
  // md, lg, and xl screens
  md={{ alignSelf: "flex-end" }}
  // xxl screens and above
  xxl={{ alignSelf: "center" }}
  {...otherProps}
/>

Layout Props Examples

Flexbox Example

Grid Example

Last modified on January 23, 2026