---
title: "Grid"

doc_type: static
doc_category: static
doc_version: v20260901
source_url:
  html: 'https://developer.shopline.com/docs/apps/checkout/checkout-ui-customizer/ui-components/structure/grid'
  md: 'https://developer.shopline.com/docs/apps/checkout/checkout-ui-customizer/ui-components/structure/grid.md'
---
# Grid

The <code data-code-gray>Grid</code> UI component is used to layout content in a matrix format consisting of rows and columns.

## Preview

![Grid&GridItem.jpg](https://s2cdn.myshopline.com/slfs/op-new/177512191416109/Grid&GridItem.jpg)

## Code example

```jsx
render('Checkout::Dynamic::Render', (root) => {
  return <>
    <Grid
      columns={[100, 'fill', '20%']}
      rows={['auto', 100, 'auto']}
      spacing="loose"
      padding="loose"
      >
      <GridItem columnSpan={3}>
        <View> Grid: </View>
      </GridItem>
      <View border="base" padding="base">
        100 / 100
      </View>
      <View border="base" padding="base">
        fill / 100
      </View>
      <View border="base" padding="base">
        20% / 100
      </View>
      <GridItem columnSpan={2}>
        <View border="base" padding="base">
          100 + fill / auto
        </View>
      </GridItem>
      <View border="base" padding="base">
        20% / auto
      </View>
    </Grid>
  </>;
});
```

## GridProps
> **tip**
>
> Optional properties are marked with a `?`. Properties without a `?` are required.

### columns?
<code data-code-gray>[MaybeResponsiveConditionalStyle](#mayberesponsiveconditionalstyle)\<[GridItemSize](#griditemsize)[] | [GridItemSize](#griditemsize)\></code>

<Margin p="8px" m="8px" />

The size of each column in the grid layout.

----

### rows?
<code data-code-gray>[MaybeResponsiveConditionalStyle](#mayberesponsiveconditionalstyle)\<[GridItemSize](#griditemsize)[] | [GridItemSize](#griditemsize)\></code>

<Margin p="8px" m="8px" />

The size of each row in the grid layout.

----

### spacing?
<code data-code-gray>[MaybeResponsiveConditionalStyle](#mayberesponsiveconditionalstyle)\<[Spacing](#spacing-1) | [[Spacing](#spacing-1), [Spacing](#spacing-1)]\></code>
<Margin p="8px" m="8px" />

The space between child elements. <br/>When two values are provided, the first value is the row spacing and the second value is the column spacing.

----

### border?
<code data-code-gray>[MaybeResponsiveConditionalStyle](#mayberesponsiveconditionalstyle)\<[MaybeShorthandProperty](#maybeshorthandproperty)\<[BorderStyle](#borderstyle)\>\></code>

<Margin p="8px" m="8px" />

The border style. This property can be defined using one, two, or four values:
- **One Value**: Applies the specified style uniformly to all four borders.
- **Two Values**: The first value sets the style for the vertical borders (top and bottom), and the second value sets the style for the horizontal borders (left and right).
- **Four Values**: Each value corresponds to an individual border in the following order: top, right, bottom, and left.

----

### cornerRadius?
<code data-code-gray>[MaybeResponsiveConditionalStyle](#mayberesponsiveconditionalstyle)&lt;[MaybeShorthandProperty](#maybeshorthandproperty)&lt;[CornerRadius](#cornerradius-1)&gt;\></code>

<Margin p="8px" m="8px" />

The corner radius size.

----

### padding?
<code data-code-gray>[MaybeResponsiveConditionalStyle](#mayberesponsiveconditionalstyle)\<[MaybeShorthandProperty](#maybeshorthandproperty)&lt;[Spacing](#spacing-1)&gt;\></code>

<Margin p="8px" m="8px" />

Configures the inner padding.

----

### overflow?
<code data-code-gray>hidden</code> <code data-code-gray>visible</code> <code data-code-white>Default: visible</code>

<Margin p="8px" m="8px" />

Configures whether to show or hide overflowing content.
- <code data-code-gray>hidden</code>: Hides overflow.
- <code data-code-gray>visible</code>: Shows overflow.

----

### inlineAlignment?
<code data-code-gray>[MaybeResponsiveConditionalStyle](#mayberesponsiveconditionalstyle)&lt;'start' | 'center' | 'end'&gt;</code>

<Margin p="8px" m="8px" />

Alignment along the horizontal axis.

----

### blockAlignment?
<code data-code-gray>[MaybeResponsiveConditionalStyle](#mayberesponsiveconditionalstyle)&lt;'start' | 'center' | 'end'｜'baseline'&gt;</code>

<Margin p="8px" m="8px" />

Alignment along the vertical axis.

----

## Type descriptions
### GridItemSize
<code data-code-gray>auto</code>
<code data-code-gray>fill</code>
<code data-code-gray>number</code>
<code data-code-gray>$\{number\}fr</code>
<code data-code-gray>$\{number\}%</code>
<Margin p="8px" m="8px" />
<Margin p="8px" m="8px" />

+ <code data-code-gray>auto</code>: Expands based on the content and does not proactively fill the remaining space.
+ <code data-code-gray>$\{number\}fr</code>: Distributes the remaining space equally, where <code data-code-gray>number</code> indicates the share of space.
+ <code data-code-gray>fill</code>: Fills the space like <code data-code-gray>1fr</code> but can shrink to 0 when the content is too long to prevent overflow.
+ <code data-code-gray>number</code>: Allocates content space according to the specified value. For example, setting <code data-code-gray>30</code> will occupy 30px.
+ <code data-code-gray>$\{number\}%</code>: Occupies content space as a percentage according to the configuration. For example, setting <code data-code-gray>30%</code> will take up 30% of the content space.

<Margin p="8px" m="8px" />
----

### Spacing
<code data-code-gray>none</code> <code data-code-gray>base</code> <code data-code-gray>extraTight</code> <code data-code-gray>tight</code> <code data-code-gray>loose</code> <code data-code-gray>extraLoose</code>
<Margin p="8px" m="8px" />
----

### BorderStyle
<code data-code-gray>base</code> <code data-code-gray>dotted</code> <code data-code-gray>none</code>
<Margin p="8px" m="8px" />
----

### CornerRadius
<code data-code-gray>base</code> <code data-code-gray>small</code> <code data-code-gray>large</code> <code data-code-gray>fullyRounded</code> <code data-code-gray>none</code>
<Margin p="8px" m="8px" />
----
### MaybeResponsiveConditionalStyle
<code data-code-gray>T | [ConditionalStyle](#conditionalstyle)\<T, [ViewportSizeCondition](#viewportsizecondition)\></code>
<Margin p="8px" m="8px" />

+ Example of a plain value: <code data-code-gray>base</code>
+ Example of a conditional value: <code data-code-gray>\{ defaultValue: 'tight', conditionals: [\{ conditions: \{ viewportInlineSize: \{ min: 'medium' } }, value: 'loose' }] }</code>

----

### ConditionalStyle
<code data-code-gray>\{ defaultValue?: T; conditionals: [ConditionalValue](#conditionalvalue)&lt;T, [Conditions](#conditions)&gt;[] }</code>
<Margin p="8px" m="8px" />

----

### ConditionalValue
<code data-code-gray>\{ conditions: [Conditions](#conditions); value: T }</code>
<Margin p="8px" m="8px" />

----

### Conditions
<code data-code-gray>[AtLeastOne](#atleastone)&lt;[ViewportSizeCondition](#viewportsizecondition)&gt;</code>
<Margin p="8px" m="8px" />

----

### ViewportSizeCondition
<code data-code-gray>\{ viewportInlineSize: \{ min: T } }</code>
<Margin p="8px" m="8px" />

----

### AtLeastOne
<code data-code-gray>Partial&lt;T&gt; &amp; U[keyof U]</code>
<Margin p="8px" m="8px" />

----

### ViewportInlineSize
<code data-code-gray>extraSmall</code> <code data-code-gray>small</code> <code data-code-gray>medium</code> <code data-code-gray>large</code>
<Margin p="8px" m="8px" />

Refer to [Viewport breakpoints](https://developer.shopline.com/docs/apps/checkout/checkout-ui-customizer/component-utilities/style-helper.md#viewport-breakpoints).

----
### MaybeShorthandProperty
<code data-code-gray>T | [ShorthandProperty](#shorthandproperty)&lt;T&gt;</code>
<Margin p="8px" m="8px" />

----

### ShorthandProperty
<code data-code-gray>[T, T]</code><code data-code-gray>[T, T, T, T]</code>
<Margin p="8px" m="8px" />
----
