--- title: Flex and Grid description: JSX style props to control flex and grid layouts --- ## Flex Basis Use the `flexBasis` prop to set the initial main size of a flex item. ```jsx ``` | Prop | CSS Property | Token Category | | ----------- | ------------ | -------------- | | `flexBasis` | `flex-basis` | - | ## Flex Direction Use the `flexDir` or `flexDirection` prop to set the direction of the main axis in a flex container. ```jsx Item 1 Item 2 Item 3 ``` When using `Flex` component, the `direction` prop is aliased to `flexDirection`. ```jsx Item 1 Item 2 Item 3 ``` | Prop | CSS Property | Token Category | | -------------------------- | ---------------- | -------------- | | `flexDir`, `flexDirection` | `flex-direction` | - | ## Flex Wrap Use the `flexWrap` prop to set whether flex items are forced onto one line or can wrap onto multiple lines. ```jsx Item 1 Item 2 Item 3 ``` When using `Flex` component, the `wrap` prop is aliased to `flexWrap`. ```jsx Item 1 Item 2 Item 3 ``` | Prop | CSS Property | Token Category | | ---------- | ------------ | -------------- | | `flexWrap` | `flex-wrap` | - | ## Flex Use the `flex` prop to define the flexibility of a flex container or item. ```jsx ``` | Prop | CSS Property | Token Category | | ------ | ------------ | -------------- | | `flex` | `flex` | - | ## Flex Grow Use the `flexGrow` prop to set the flex grow factor of a flex item. ```jsx ``` | Prop | CSS Property | Token Category | | ---------- | ------------ | -------------- | | `flexGrow` | `flex-grow` | - | ## Flex Shrink Use the `flexShrink` prop to set the flex shrink factor of a flex item. ```jsx ``` | Prop | CSS Property | Token Category | | ------------ | ------------- | -------------- | | `flexShrink` | `flex-shrink` | - | ## Order Use the `order` prop to set the order of a flex item. ```jsx ``` | Prop | CSS Property | Token Category | | ------- | ------------ | -------------- | | `order` | `order` | - | ## Gap Use the `gap` prop to set the gap between items in a flex or grid container. ```jsx Item 1 Item 2 Item 3 ``` | Prop | CSS Property | Token Category | | ----- | ------------ | -------------- | | `gap` | `gap` | `spacing` | ## Grid Template Columns Use the `gridTemplateColumns` prop to define the columns of a grid container. ```jsx Item 1 Item 2 Item 3 ``` When using `Grid` component, the `templateColumns` prop is aliased to `gridTemplateColumns`. ```jsx Item 1 Item 2 Item 3 ``` ## Grid Template Start/End Use the `gridTemplateStart` and `gridTemplateEnd` props to define the start and end of a grid container. ```jsx Item 1 Item 2 Item 3 ``` | Prop | CSS Property | Token Category | | ------------------- | --------------------- | -------------- | | `gridTemplateStart` | `grid-template-start` | - | | `gridTemplateEnd` | `grid-template-end` | - | ## Grid Template Rows Use the `gridTemplateRows` prop to define the rows of a grid container. ```jsx Item 1 Item 2 Item 3 ``` | Prop | CSS Property | Token Category | | ------------------ | -------------------- | -------------- | | `gridTemplateRows` | `grid-template-rows` | - | ## Grid Row Start/End Use the `gridRowStart` and `gridRowEnd` props to define the start and end of a grid item. ```jsx Item 1 Item 2 Item 3 ``` | Prop | CSS Property | Token Category | | -------------- | ---------------- | -------------- | | `gridRowStart` | `grid-row-start` | - | | `gridRowEnd` | `grid-row-end` | - | ## Grid Autoflow Use the `gridAutoFlow` prop to define how auto-placed items get flowed into the grid. ```jsx Item 1 Item 2 Item 3 ``` | Prop | CSS Property | Token Category | | -------------- | ---------------- | -------------- | | `gridAutoFlow` | `grid-auto-flow` | - | ## Grid Auto Columns Use the `gridAutoColumns` prop to specify the size of the grid columns that were created without an explicit size. ```jsx Item 1 Item 2 Item 3 ``` | Prop | CSS Property | Token Category | | ----------------- | ------------------- | -------------- | | `gridAutoColumns` | `grid-auto-columns` | - | ## Grid Auto Rows Use the `gridAutoRows` prop to specify the size of the grid rows that were created without an explicit size. ```jsx Item 1 Item 2 Item 3 ``` | Prop | CSS Property | Token Category | | -------------- | ---------------- | -------------- | | `gridAutoRows` | `grid-auto-rows` | - | ## Justify Content Use the `justifyContent` prop to align items along the main axis of a flex container. ```jsx Item 1 Item 2 Item 3 ``` When using the `Flex` component, the `justify` prop is aliased to `justifyContent`. ```jsx Item 1 Item 2 Item 3 ``` | Prop | CSS Property | Token Category | | ---------------- | ----------------- | -------------- | | `justifyContent` | `justify-content` | - | ## Justify Items Use the `justifyItems` prop to control the alignment of grid items within their scope. ```jsx Item 1 Item 2 Item 3 ``` | Prop | CSS Property | Token Category | | -------------- | --------------- | -------------- | | `justifyItems` | `justify-items` | - | ## Align Content Use the `alignContent` prop to align rows of content along the cross axis of a flex container when there's extra space. ```jsx Item 1 Item 2 Item 3 ``` When using the `Flex` component, the `align` prop is aliased to `alignContent`. ```jsx Item 1 Item 2 Item 3 ``` | Prop | CSS Property | Token Category | | -------------- | --------------- | -------------- | | `alignContent` | `align-content` | - | ## Align Items Use the `alignItems` prop to control the alignment of grid items within their scope. ```jsx Item 1 Item 2 Item 3 ``` ## Align Self Use the `alignSelf` prop to control the alignment of a grid item within its scope. ```jsx Item 1 Item 2 Item 3 ``` | Prop | CSS Property | Token Category | | ----------- | ------------ | -------------- | | `alignSelf` | `align-self` | - | ## Place Content Use the `placeContent` prop to align content along both the block and inline directions at once. It works like `justifyContent` and `alignContent` combined, and can be used in flex and grid containers. ```jsx Item 1 Item 2 Item 3 ``` | Prop | CSS Property | Token Category | | -------------- | --------------- | -------------- | | `placeContent` | `place-content` | - | ## Place Items Use the `placeItems` prop to align items along both the block and inline directions at once. It works like `justifyItems` and `alignItems` combined, and can be used in flex and grid containers. ```jsx Item 1 Item 2 Item 3 ``` | Prop | CSS Property | Token Category | | ------------ | ------------- | -------------- | | `placeItems` | `place-items` | - | ## Place Self Use the `placeSelf` prop to align a grid item along both the block and inline directions at once. ```jsx Item 1 Item 2 Item 3 ``` | Prop | CSS Property | Token Category | | ----------- | ------------ | -------------- | | `placeSelf` | `place-self` | - |