> To build a Wix site agentically, or add Wix features like bookings or a store to a site you already have, follow https://www.wix.com/headless/skill.md
> 
> Portal Navigation:
> 
> - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version.
> - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages).
> - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`).
> - If a reference page seems to be missing its schema (parameters, return types, or type definitions), append `?schema=true` to its `.md` URL (e.g. `https://dev.wix.com/docs/contexts/contexts/stores/category-info/use-category-info-context.md?schema=true`).
> - Top-level index of all portals: https://dev.wix.com/docs/llms.txt
> - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt

## Resource: Layout Component

## Article: Layout Component

## Article Link: https://dev.wix.com/docs/wix-design-system/components/layout/layout-component.md

## Article Content:

# Layout

_Components/Layout_

Interactive docs page: <https://wix-pages.com/design-system-documentation/#/component/layout>

## Overview

```jsx
<Layout rowHeight={180}>
  <Cell span={1}>
    <StorybookComponents.Placeholder />
  </Cell>
  <Cell span={1}>
    <StorybookComponents.Placeholder />
  </Cell>
  <Cell span={1}>
    <StorybookComponents.Placeholder />
  </Cell>
  <Cell span={1}>
    <StorybookComponents.Placeholder />
  </Cell>
  <Cell span={1}>
    <StorybookComponents.Placeholder />
  </Cell>
  <Cell span={1}>
    <StorybookComponents.Placeholder />
  </Cell>
  <Cell span={1}>
    <StorybookComponents.Placeholder />
  </Cell>
  <Cell span={1}>
    <StorybookComponents.Placeholder />
  </Cell>
  <Cell span={1}>
    <StorybookComponents.Placeholder />
  </Cell>
  <Cell span={1}>
    <StorybookComponents.Placeholder />
  </Cell>
  <Cell span={1}>
    <StorybookComponents.Placeholder />
  </Cell>
  <Cell span={1}>
    <StorybookComponents.Placeholder />
  </Cell>
</Layout>;
```

Layout is a wrapper component that allows users to arrange children items in a grid of columns and rows. It's based on the CSS grid.

### Do

- Use it to structure content inside of a `<Page/>` .
- Use it to organize form fields inside of a `<Card/>` .

### Don't

- Don't use it to structure a list of items. Use `<Box/>` instead.

### Feature examples

#### Structure

The component consists of 2 core parts:

- A `<Layout/>` wrapper that defines the total number of columns in the container, the default is 12 columns.
- A `<Cell/>` that contains any type of content (for example, a form field). The user can define how many columns and rows it spans, the default is 12 columns and 1 row.

```jsx
<Layout>
  <Cell>
    <StorybookComponents.Placeholder>Cell</StorybookComponents.Placeholder>
  </Cell>
</Layout>;
```

#### Columns

Use `span `to control the width of a content `<Cell/>`,by specifying the number of grid columns a cell will occupy. If not specified, it will occupy all 12 columns (full width).

```jsx
<Layout>
  <Cell>
    <StorybookComponents.Placeholder>12 cols</StorybookComponents.Placeholder>
  </Cell>
  <Cell span={6}>
    <StorybookComponents.Placeholder>6 cols</StorybookComponents.Placeholder>
  </Cell>
  <Cell span={6}>
    <StorybookComponents.Placeholder>6 cols</StorybookComponents.Placeholder>
  </Cell>
  <Cell span={4}>
    <StorybookComponents.Placeholder>4 cols</StorybookComponents.Placeholder>
  </Cell>
  <Cell span={4}>
    <StorybookComponents.Placeholder>4 cols</StorybookComponents.Placeholder>
  </Cell>
  <Cell span={4}>
    <StorybookComponents.Placeholder>4 cols</StorybookComponents.Placeholder>
  </Cell>
  <Cell span={3}>
    <StorybookComponents.Placeholder>3 cols</StorybookComponents.Placeholder>
  </Cell>
  <Cell span={3}>
    <StorybookComponents.Placeholder>3 cols</StorybookComponents.Placeholder>
  </Cell>
  <Cell span={3}>
    <StorybookComponents.Placeholder>3 cols</StorybookComponents.Placeholder>
  </Cell>
  <Cell span={3}>
    <StorybookComponents.Placeholder>3 cols</StorybookComponents.Placeholder>
  </Cell>
  <Cell span={2}>
    <StorybookComponents.Placeholder>2 cols</StorybookComponents.Placeholder>
  </Cell>
  <Cell span={2}>
    <StorybookComponents.Placeholder>2 cols</StorybookComponents.Placeholder>
  </Cell>
  <Cell span={2}>
    <StorybookComponents.Placeholder>2 cols</StorybookComponents.Placeholder>
  </Cell>
  <Cell span={2}>
    <StorybookComponents.Placeholder>2 cols</StorybookComponents.Placeholder>
  </Cell>
  <Cell span={2}>
    <StorybookComponents.Placeholder>2 cols</StorybookComponents.Placeholder>
  </Cell>
  <Cell span={2}>
    <StorybookComponents.Placeholder>2 cols</StorybookComponents.Placeholder>
  </Cell>
  <Cell span={1}>
    <StorybookComponents.Placeholder>1 col</StorybookComponents.Placeholder>
  </Cell>
  <Cell span={1}>
    <StorybookComponents.Placeholder>1 col</StorybookComponents.Placeholder>
  </Cell>
  <Cell span={1}>
    <StorybookComponents.Placeholder>1 col</StorybookComponents.Placeholder>
  </Cell>
  <Cell span={1}>
    <StorybookComponents.Placeholder>1 col</StorybookComponents.Placeholder>
  </Cell>
  <Cell span={1}>
    <StorybookComponents.Placeholder>1 col</StorybookComponents.Placeholder>
  </Cell>
  <Cell span={1}>
    <StorybookComponents.Placeholder>1 col</StorybookComponents.Placeholder>
  </Cell>
  <Cell span={1}>
    <StorybookComponents.Placeholder>1 col</StorybookComponents.Placeholder>
  </Cell>
  <Cell span={1}>
    <StorybookComponents.Placeholder>1 col</StorybookComponents.Placeholder>
  </Cell>
  <Cell span={1}>
    <StorybookComponents.Placeholder>1 col</StorybookComponents.Placeholder>
  </Cell>
  <Cell span={1}>
    <StorybookComponents.Placeholder>1 col</StorybookComponents.Placeholder>
  </Cell>
  <Cell span={1}>
    <StorybookComponents.Placeholder>1 col</StorybookComponents.Placeholder>
  </Cell>
  <Cell span={1}>
    <StorybookComponents.Placeholder>1 col</StorybookComponents.Placeholder>
  </Cell>
</Layout>;
```

#### Rows

Use `rows` to specify the number of grid rows the `<Cell/>` occupies, the default is 1 row.

```jsx
<Layout>
  <Cell span={6} rows={6}>
    <StorybookComponents.Placeholder>6 rows</StorybookComponents.Placeholder>
  </Cell>
  <Cell span={6}>
    <StorybookComponents.Placeholder>1 row</StorybookComponents.Placeholder>
  </Cell>
  <Cell span={6}>
    <StorybookComponents.Placeholder>1 row</StorybookComponents.Placeholder>
  </Cell>
  <Cell span={6}>
    <StorybookComponents.Placeholder>1 row</StorybookComponents.Placeholder>
  </Cell>
  <Cell span={6}>
    <StorybookComponents.Placeholder>1 row</StorybookComponents.Placeholder>
  </Cell>
  <Cell span={6}>
    <StorybookComponents.Placeholder>1 row</StorybookComponents.Placeholder>
  </Cell>
  <Cell span={6}>
    <StorybookComponents.Placeholder>1 row</StorybookComponents.Placeholder>
  </Cell>
</Layout>;
```

#### Row height

The height of rows inside a layout can be set individually or altogether:

- By default, each row is sized separately. The height is determined by the item of the greatest height within the row.
- To size all rows equally, choose to set them according to the item of the greatest height within the layout by setting all of them to `rowHeight=1fr `or set them in pixels, with `rowHeight`.

```jsx
<Layout cols={1} gap="60px">
  <Layout>
    <Cell span={4}>
      <StorybookComponents.Placeholder>
        This layout uses the default sizing which stretches cells vertically to
        match the item of greatest height in the row. The height of the first
        row is different than the second row, because of the text in this cell.
      </StorybookComponents.Placeholder>
    </Cell>
    <Cell span={4}>
      <StorybookComponents.Placeholder>1 row</StorybookComponents.Placeholder>
    </Cell>
    <Cell span={4}>
      <StorybookComponents.Placeholder>1 row</StorybookComponents.Placeholder>
    </Cell>
    <Cell span={4}>
      <StorybookComponents.Placeholder>2 row</StorybookComponents.Placeholder>
    </Cell>
    <Cell span={4}>
      <StorybookComponents.Placeholder>2 row</StorybookComponents.Placeholder>
    </Cell>
    <Cell span={4}>
      <StorybookComponents.Placeholder>2 row</StorybookComponents.Placeholder>
    </Cell>
  </Layout>
  <Layout rowHeight="1fr">
    <Cell span={4}>
      <StorybookComponents.Placeholder>
        Here all the rows are sized equally, according to the item with the
        greatest height in the layout. All of the rows are set to 1fr and have
        the same height.
      </StorybookComponents.Placeholder>
    </Cell>
    <Cell span={4}>
      <StorybookComponents.Placeholder>1 row</StorybookComponents.Placeholder>
    </Cell>
    <Cell span={4}>
      <StorybookComponents.Placeholder>1 row</StorybookComponents.Placeholder>
    </Cell>
    <Cell span={4}>
      <StorybookComponents.Placeholder>2 row</StorybookComponents.Placeholder>
    </Cell>
    <Cell span={4}>
      <StorybookComponents.Placeholder>2 row</StorybookComponents.Placeholder>
    </Cell>
    <Cell span={4}>
      <StorybookComponents.Placeholder>2 row</StorybookComponents.Placeholder>
    </Cell>
  </Layout>
  <Layout rowHeight="60px">
    <Cell span={4}>
      <StorybookComponents.Placeholder>
        Here the row height is set in pixels, all cells in all rows have the
        same height.
      </StorybookComponents.Placeholder>
    </Cell>
    <Cell span={4}>
      <StorybookComponents.Placeholder>1 row</StorybookComponents.Placeholder>
    </Cell>
    <Cell span={4}>
      <StorybookComponents.Placeholder>1 row</StorybookComponents.Placeholder>
    </Cell>
    <Cell span={4}>
      <StorybookComponents.Placeholder>2 row</StorybookComponents.Placeholder>
    </Cell>
    <Cell span={4}>
      <StorybookComponents.Placeholder>2 row</StorybookComponents.Placeholder>
    </Cell>
    <Cell span={4}>
      <StorybookComponents.Placeholder>2 row</StorybookComponents.Placeholder>
    </Cell>
  </Layout>
</Layout>;
```

#### Gap

Control the space between content cells with `gap` property. The same gap is applied horizontally and vertically (between rows and columns).

The default gap value is 24px.

```jsx
<Layout cols={2}>
  <Layout gap="24px">
    <Cell>
      <StorybookComponents.Placeholder>
        24px gap (default)
      </StorybookComponents.Placeholder>
    </Cell>
    <Cell>
      <StorybookComponents.Placeholder>
        24px gap
      </StorybookComponents.Placeholder>
    </Cell>
    <Cell>
      <StorybookComponents.Placeholder>
        24px gap
      </StorybookComponents.Placeholder>
    </Cell>
  </Layout>
  <Layout gap="0px">
    <Cell>
      <StorybookComponents.Placeholder>No gap</StorybookComponents.Placeholder>
    </Cell>
    <Cell>
      <StorybookComponents.Placeholder>No gap</StorybookComponents.Placeholder>
    </Cell>
    <Cell>
      <StorybookComponents.Placeholder>No gap</StorybookComponents.Placeholder>
    </Cell>
  </Layout>
</Layout>;
```

#### Align items

By default, all cells inside of the row stretch vertically according to the cell of the greatest height in the row.

Size each cell separately according to its content and align it vertically with `alignItems`, it supports all [CSS values.](https://developer.mozilla.org/en-US/docs/Web/CSS/align-items)

```jsx
<StorybookComponents.Stack flexDirection="column">
  <Layout>
    <Cell span={4}>
      <StorybookComponents.Placeholder>
        Stretched
      </StorybookComponents.Placeholder>
    </Cell>
    <Cell span={4}>
      <StorybookComponents.Placeholder>
        Stretched
      </StorybookComponents.Placeholder>
    </Cell>
    <Cell span={4}>
      <StorybookComponents.Placeholder height="120px">
        Stretched
      </StorybookComponents.Placeholder>
    </Cell>
  </Layout>
  <Layout alignItems="flex-start">
    <Cell span={4}>
      <StorybookComponents.Placeholder>
        Top aligned
      </StorybookComponents.Placeholder>
    </Cell>
    <Cell span={4}>
      <StorybookComponents.Placeholder>
        Top aligned
      </StorybookComponents.Placeholder>
    </Cell>
    <Cell span={4}>
      <StorybookComponents.Placeholder height="120px">
        Top aligned
      </StorybookComponents.Placeholder>
    </Cell>
  </Layout>
</StorybookComponents.Stack>;
```

#### Justify items

By default, cells inside of the row stretch horizontally.

Size each cell separately according to its content and align it horizontally with `justifyItems` prop.

It supports all [CSS values](https://developer.mozilla.org/en-US/docs/Web/CSS/justify-items).

```jsx
<StorybookComponents.Stack flexDirection="column">
  <Layout>
    <Cell span={4}>
      <StorybookComponents.Placeholder>
        Stretched
      </StorybookComponents.Placeholder>
    </Cell>
    <Cell span={4}>
      <StorybookComponents.Placeholder>
        Stretched
      </StorybookComponents.Placeholder>
    </Cell>
    <Cell span={4}>
      <StorybookComponents.Placeholder>
        Stretched
      </StorybookComponents.Placeholder>
    </Cell>
  </Layout>
  <Layout justifyItems="end">
    <Cell span={4}>
      <StorybookComponents.Placeholder>
        End Aligned
      </StorybookComponents.Placeholder>
    </Cell>
    <Cell span={4}>
      <StorybookComponents.Placeholder>
        End Aligned
      </StorybookComponents.Placeholder>
    </Cell>
    <Cell span={4}>
      <StorybookComponents.Placeholder>
        End Aligned
      </StorybookComponents.Placeholder>
    </Cell>
  </Layout>
</StorybookComponents.Stack>;
```

### Common use case examples

#### Card layout

Use layout to arrange content in columns and rows inside of cards and widgets.

```jsx
() => {
  const [checked, setChecked] = React.useState(true);
  return (
    <Card>
      <Card.Header title="Menu info" />
      <Card.Divider />
      <Card.Content>
        <Layout>
          <Cell span={8}>
            <FormField label="Name">
              <Input />
            </FormField>
          </Cell>
          <Cell span={8}>
            <FormField label="Description">
              <InputArea
                minHeight="120px"
                resizable
                placeholder="Get people excited about your menu and food"
              />
            </FormField>
          </Cell>
          <Cell>
            <Box>
              <FormField label="Visible for customers" labelPlacement="right">
                <ToggleSwitch
                  checked={checked}
                  onChange={() => setChecked(!checked)}
                  size="medium"
                />
              </FormField>
            </Box>
          </Cell>
        </Layout>
      </Card.Content>
    </Card>
  );
};
```

#### Page layout

Use layout to arrange content inside of a page. Check `<Page/>` for all common layouts.

```jsx
<Page>
  <Page.Header title="Main Menu"></Page.Header>
  <Page.Content>
    <Layout>
      <Cell>
        <Layout>
          <Cell span={8}>
            <Card>
              <Card.Header
                title="Sections"
                suffix={
                  <Button size="small" prefixIcon={<Icons.AddSmall />}>
                    New Section
                  </Button>
                }
              />
              <Card.Divider />
              <Box height="480px" />
            </Card>
          </Cell>
          <Cell span={4}>
            <Card>
              <Card.Header
                title="Menu info"
                suffix={
                  <Button
                    size="small"
                    priority="secondary"
                    prefixIcon={<Icons.EditSmall />}
                  >
                    Edit
                  </Button>
                }
              />
              <Card.Divider />
              <Box height="240px" />
            </Card>
          </Cell>
        </Layout>
      </Cell>
    </Layout>
  </Page.Content>
</Page>;
```

## Code

```jsx
import { Layout } from '@wix/design-system';
```

### Props

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| `alignItems` | `"center" \| "end" \| "start" \| string & {} \| "-moz-initial" \| "inherit" \| "initial" \| "revert" \| "revert-layer" \| "unset" \| "baseline" \| "normal" \| "flex-end" \| "flex-start" \| "self-end" \| "self-start" \| "stretch"` | — | Aligns grid items on the Y axis. |
| `children` | `ReactNode` | — | Accept single or multiple compound <Cell/> elements which store content items. Other nodes are accepted but not recommended. |
| `cols` | `number` | — | Set a number of grid columns to be rendered. |
| `dataHook` | `string` | — | Applies a data-hook HTML attribute that can be used in the tests. |
| `gap` | `string \| number \| string & {}` | `24px` | Control both vertical and horizontal distance between layout cells. |
| `height` | `string \| number \| string & {}` | — | Set the height of the layout. |
| `justifyItems` | `"center" \| "end" \| "start" \| "right" \| "left" \| string & {} \| "-moz-initial" \| "inherit" \| "initial" \| "revert" \| "revert-layer" \| "unset" \| "baseline" \| "normal" \| "flex-end" \| "flex-start" \| "self-end" \| "self-start" \| "legacy" \| "stretch"` | — | Align grid items on the X axis. |
| `rowHeight` | `string \| number \| string & {}` | `auto` | Set all rows to have the same height in pixels or percentage. |

## Testkit

No testkit for this component — it doesn't expose a unidriver testkit.

## Changelog

- **1.340.0** (2026-10-21) — maintenance release, no component-specific changes
- **1.339.0** (2026-10-19) — maintenance release, no component-specific changes
- **1.338.0** (2026-10-15) — maintenance release, no component-specific changes
- **1.331.0** (2026-10-01) — maintenance release, no component-specific changes
- **1.330.0** (2026-09-28) — maintenance release, no component-specific changes
- **1.329.0** (2026-09-24) — maintenance release, no component-specific changes
- **1.325.0** (2026-09-17) — maintenance release, no component-specific changes
- **1.310.0** (2026-08-10) — maintenance release, no component-specific changes
- **1.292.0** (2026-06-22) — maintenance release, no component-specific changes
- **1.291.0** (2026-06-19) — maintenance release, no component-specific changes
- **1.288.0** (2026-06-15) — maintenance release, no component-specific changes
- **1.271.0** (2026-04-22) — maintenance release, no component-specific changes
- **1.266.0** (2026-04-07) — maintenance release, no component-specific changes
- **1.260.0** (2026-03-17) — maintenance release, no component-specific changes
- **1.224.0** (2025-10-30) — maintenance release, no component-specific changes
- **1.198.2** (2025-06-09) — fix: fix cannot be used as a JSX component error ([#14969](invalid-url))
- **1.198.1** (2025-06-09) — maintenance release, no component-specific changes
- **1.188.1** (2025-05-14) — maintenance release, no component-specific changes
- **1.138.1** (2024-10-30) — maintenance release, no component-specific changes
- **1.115.0** (2024-07-17) — maintenance release, no component-specific changes
- **1.93.0** (2024-02-08) — feat: introduce height property ([#13262](invalid-url))
- **1.92.1** (2024-02-05) — maintenance release, no component-specific changes