> ## Documentation Index
> Fetch the complete documentation index at: https://doc.lucidworks.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Grid

export const LwTemplate = ({title = "Key questions to get you started", icon = "sparkles", cta = "Powered by Agent Studio", linkHref = "https://lucidworks.com/demo/?utm_source=docs&utm_medium=referral&utm_campaign=docs_cta_ai"}) => {
  const [isLoaded, setIsLoaded] = useState(false);
  useEffect(() => {
    const timer = setTimeout(() => {
      setIsLoaded(true);
    }, 500);
    return () => clearTimeout(timer);
  }, []);
  return <div className="lw-template-container">
      <Card title={title} icon={icon}>
        {isLoaded && <span dangerouslySetInnerHTML={{
    __html: `<lw-template id="a029c1a9-28be-427e-b0e1-5d918920246a"></lw-template
            >`
  }} />}
        <Link href={linkHref} className="agent-studio-link text-left text-gray-600 gap-2 dark:text-gray-400 text-sm font-medium flex flex-row items-center hover:text-primary dark:hover:text-primary-light group-hover:text-primary group-hover:dark:text-primary-light">Powered by Lucidworks Agent Studio</Link>
      </Card>
    </div>;
};

[localhost link]: http://localhost:3000/docs/5/app-studio/reference/gallery/grid

[mintlify link]: https://doc.lucidworks.com/docs/5/app-studio/reference/gallery/grid

[old doc.lw link]: https://doc.lucidworks.com/app-studio/4.2/1032

<LwTemplate />

## Grid System

| API       | Device width when breakpoint overrides default                         |
| --------- | ---------------------------------------------------------------------- |
| default   | Sets default layout direction unless overridden by another breakpoint. |
| @xs-width | width \< 35.5 em                                                       |
| @sm-width | 600 em ⇐ width \< 35.5 em                                              |
| @md-width | 35.5 em ⇐ width \< 48 em                                               |
| @lg-width | 48 em ⇐ width \< 64 em                                                 |
| @xl-width | width >= 80 em                                                         |

Twigkit uses a response 24 column grid system. The column widths are specified using a ratio of 24ths.

For example at the attribute `sm="1-3"` to the `layout:block` tag to set the width to 1/3 of the container width on small screens.

By default `layout:blocks` will be 100% width.

<img src="https://mintcdn.com/lucidworks/vACLe5BtgzmMoCXX/assets/images/app-studio/as-examples/gallery/grid02.png?fit=max&auto=format&n=vACLe5BtgzmMoCXX&q=85&s=418279b8eea0f83597cd151120ecb56d" alt="Example" width="1271" height="720" data-path="assets/images/app-studio/as-examples/gallery/grid02.png" />

```xml wrap  theme={"dark"}
<layout:grid styling="text-white">
    <layout:block xs="1"><layout:box styling="bg-raspberry-dark">1 (Default)</layout:box></layout:block>
    <layout:block xs="23-24"><layout:box styling="bg-raspberry">23-24</layout:box></layout:block>
    <layout:block xs="7-8"><layout:box styling="bg-raspberry-light">7-8</layout:box></layout:block>
    <layout:block xs="5-6"><layout:box styling="bg-strawberry-light">5-6</layout:box></layout:block>
    <layout:block xs="4-5"><layout:box styling="bg-strawberry">4-5</layout:box></layout:block>
    <layout:block xs="3-4"><layout:box styling="bg-strawberry-dark">3-4</layout:box></layout:block>
    <layout:block xs="2-3"><layout:box styling="bg-carrot">2-3</layout:box></layout:block>
    <layout:block xs="1-2"><layout:box styling="bg-carrot-light">1-2</layout:box></layout:block>
</layout:grid>
```

## Grid Breakpoints

Widths can be specified for each of the `xs`, `sm`, `md`, `lg`, and `xl` breakpoints individually.

`lg`

<img src="https://mintcdn.com/lucidworks/vACLe5BtgzmMoCXX/assets/images/app-studio/as-examples/gallery/grid03a.png?fit=max&auto=format&n=vACLe5BtgzmMoCXX&q=85&s=ccfcc55870df4817d63e512031b2d258" alt="Example" width="1271" height="257" data-path="assets/images/app-studio/as-examples/gallery/grid03a.png" />

`md`

<img src="https://mintcdn.com/lucidworks/vACLe5BtgzmMoCXX/assets/images/app-studio/as-examples/gallery/grid03b.png?fit=max&auto=format&n=vACLe5BtgzmMoCXX&q=85&s=2be87226b0334a4c6ac5d25ddc71e958" alt="Example" width="1271" height="334" data-path="assets/images/app-studio/as-examples/gallery/grid03b.png" />

`sm`

<img src="https://mintcdn.com/lucidworks/vACLe5BtgzmMoCXX/assets/images/app-studio/as-examples/gallery/grid03d.png?fit=max&auto=format&n=vACLe5BtgzmMoCXX&q=85&s=b0ae25c0a0f77d5e872e2dab2ba28d61" alt="Example" width="1271" height="411" data-path="assets/images/app-studio/as-examples/gallery/grid03d.png" />

```xml wrap  theme={"dark"}
<layout:grid styling="text-white">
    <layout:block xs="1">
        <layout:box styling="bg-sunflower">Always full width</layout:box>
    </layout:block>
    <layout:grid>
        <layout:block xl="1-3" md="1-2">
            <layout:box styling="bg-pumpkin-light">xl=1-3, md=1-2</layout:box>
        </layout:block>
        <layout:block xl="1-3" md="1-2">
            <layout:box styling="bg-pumpkin">xl=1-3, md=1-2</layout:box>
        </layout:block>
        <layout:block xl="1-3" md="1">
            <layout:box styling="bg-pumpkin-dark">xl=1-3, md=1</layout:box>
        </layout:block>
    </layout:grid>
</layout:grid>
```

## Grid Offsets

An offset attribute can be used to push the `layout:block` to the right, leaving an empty space

<img src="https://mintcdn.com/lucidworks/vACLe5BtgzmMoCXX/assets/images/app-studio/as-examples/gallery/grid04.png?fit=max&auto=format&n=vACLe5BtgzmMoCXX&q=85&s=60638eb62c08375af6509e7a91777d09" alt="Example" width="1271" height="411" data-path="assets/images/app-studio/as-examples/gallery/grid04.png" />

```xml wrap  expandable  theme={"dark"}
<layout:grid styling="text-white">
    <layout:block xs="1">
        <layout:box styling="bg-mint">Always full width</layout:box>
    </layout:block>
    <layout:grid>
        <layout:block xl="1-3" md="1-2">
            <layout:box styling="bg-mint-light">xl=1-3, md=1-2</layout:box>
        </layout:block>
        <layout:block xl="1-3" md="1-2" xl-offset="1-3">
            <layout:box styling="bg-mint">xl=1-3 xl-offset=1-3, md=1-2</layout:box>
        </layout:block>
    </layout:grid>
    <layout:grid>
        <layout:block xs="1-2" xs-offset="1-4" sm-offset="1-2" md-offset="0">
            <layout:box styling="bg-aqua">No offset md and above</layout:box>
        </layout:block>
    </layout:grid>
    <layout:grid>
        <layout:block xs="1-2" sm-offset="1-4">
            <layout:box styling="bg-aqua-dark">Offset at sm and above</layout:box>
        </layout:block>
    </layout:grid>
</layout:grid>
```

## Nested

Standard Button

<img src="https://mintcdn.com/lucidworks/vACLe5BtgzmMoCXX/assets/images/app-studio/as-examples/gallery/grid06.png?fit=max&auto=format&n=vACLe5BtgzmMoCXX&q=85&s=1e0b8e11be732385a0221e015890a8bc" alt="Example" width="1271" height="244" data-path="assets/images/app-studio/as-examples/gallery/grid06.png" />

```xml wrap  expandable  theme={"dark"}
<layout:grid styling="text-white">
    <layout:block xs="1-1" sm="1-2" md="1-4">
        <layout:box styling="bg-aqua-light">
            .tk-rgrid-u-1 <br>
            .tk-rgrid-u-sm-1-2 <br>
            .tk-rgrid-u-md-1-4 <br>
        </layout:box>
    </layout:block>
    <layout:block xs="1-1" sm="1-2" md="1-4">
        <layout:box styling="bg-sky-light">
            .tk-rgrid-u-1 <br>
            .tk-rgrid-u-sm-1-2 <br>
            .tk-rgrid-u-md-1-4 <br>
        </layout:box>
    </layout:block>
    <layout:block xs="1-1" sm="1-2" md="1-4">
        <layout:box styling="bg-sky">
            .tk-rgrid-u-1 <br>
            .tk-rgrid-u-sm-1-2 <br>
            .tk-rgrid-u-md-1-4 <br>
        </layout:box>
    </layout:block>
    <layout:block xs="1-1" sm="1-2" md="1-4">
        <layout:box styling="bg-sky-dark">
            .tk-rgrid-u-1 <br>
            .tk-rgrid-u-sm-1-2 <br>
            .tk-rgrid-u-md-1-4 <br>
        </layout:box>
    </layout:block>
</layout:grid>
```

## Image

Standard Button

<img src="https://mintcdn.com/lucidworks/vACLe5BtgzmMoCXX/assets/images/app-studio/as-examples/gallery/grid07.png?fit=max&auto=format&n=vACLe5BtgzmMoCXX&q=85&s=d7d0c66ae4eef568c8c24315ba991b90" alt="Example" width="1271" height="318" data-path="assets/images/app-studio/as-examples/gallery/grid07.png" />

```xml wrap  expandable  theme={"dark"}
<layout:grid>
    <layout:block xs="1-1" sm="1-2" md="1-4">
        <layout:box styling="bg-paper">
            <p>
                .tk-rgrid-u-1 <br>
                .tk-rgrid-u-sm-1-2 <br>
                .tk-rgrid-u-md-1-4 <br>
            </p>
        </layout:box>
    </layout:block>
    <layout:block xs="1-1" sm="1-2" md="1-4">
        <layout:box styling="bg-paper-dark">
            <p>
                .tk-rgrid-u-1 <br>
                .tk-rgrid-u-sm-1-2 <br>
                .tk-rgrid-u-md-1-4 <br>
            </p>
        </layout:box>
    </layout:block>
    <layout:block xs="1-1" sm="1-2" md="2-4">
        <layout:box styling="bg-paper">
            <p>
                .tk-rgrid-u-sm-1-2 <br>
                .tk-rgrid-u-md-2-4 <br>
            </p>
            <layout:grid>
                <layout:block sm="1-1" md="1-2">
                    <layout:box styling="bg-paper-light">
                        <p>
                            .tk-rgrid-u-1 <br>
                            .tk-rgrid-u-md-1-2 <br>
                        </p>
                    </layout:box>
                </layout:block>
                <layout:block sm="1-1" md="1-2">
                    <layout:box styling="bg-paper-dark">
                        <p>
                            .tk-rgrid-u-1 <br>
                            .tk-rgrid-u-md-1-2 <br>
                        </p>
                    </layout:box>
                </layout:block>
            </layout:grid>
        </layout:box>
    </layout:block>
</layout:grid>
```

## Justify Content

<img src="https://mintcdn.com/lucidworks/vACLe5BtgzmMoCXX/assets/images/app-studio/as-examples/gallery/grid08.png?fit=max&auto=format&n=vACLe5BtgzmMoCXX&q=85&s=a62de83c56d604d3a58b5c3500d3a6b2" alt="Example" width="1271" height="167" data-path="assets/images/app-studio/as-examples/gallery/grid08.png" />

```xml wrap  theme={"dark"}
<layout:grid>
    <layout:block styling="center-content bg-raspberry text-white" md="1-2">
        <p>Long content</p>
        <br><br><br><br><br><br><br>
    </layout:block>
    <layout:block md="1-2">
        <div styling="stretch-content">
            <layout:block styling="center-content bg-strawberry text-white" md="1-2">item 1</layout:block>
            <layout:block styling="center-content bg-carrot text-white" md="1-2">item2</layout:block>
            <layout:block styling="center-content bg-pumpkin text-white full-width">item 3</layout:block>
        </div>
    </layout:block>
</layout:grid>
```

## Hide

You can hide the layout by using hide or show at your desire size point `styling="hide-xs"`

`xl`

<img src="https://mintcdn.com/lucidworks/vACLe5BtgzmMoCXX/assets/images/app-studio/as-examples/gallery/grid09a.png?fit=max&auto=format&n=vACLe5BtgzmMoCXX&q=85&s=41c9396682eef48dae97a3ac54426ed7" alt="Example" width="1271" height="257" data-path="assets/images/app-studio/as-examples/gallery/grid09a.png" />

`md`

<img src="https://mintcdn.com/lucidworks/vACLe5BtgzmMoCXX/assets/images/app-studio/as-examples/gallery/grid09b.png?fit=max&auto=format&n=vACLe5BtgzmMoCXX&q=85&s=534c595d4ad6db7b3ca5e6819887f21f" alt="Example" width="1080" height="289" data-path="assets/images/app-studio/as-examples/gallery/grid09b.png" />

`xs`

<img src="https://mintcdn.com/lucidworks/vACLe5BtgzmMoCXX/assets/images/app-studio/as-examples/gallery/grid09d.png?fit=max&auto=format&n=vACLe5BtgzmMoCXX&q=85&s=b28dbdadc900c4673b3476225f7ba6d0" alt="Example" width="1271" height="489" data-path="assets/images/app-studio/as-examples/gallery/grid09d.png" />

```xml wrap  expandable  theme={"dark"}
<layout:grid>
    <layout:block md="1-5" styling="hide-xs bg-concrete-light">
        <layout:box>hide @xs-width</layout:box>
    </layout:block>
    <layout:block md="1-5" styling="hide-sm bg-concrete">
        <layout:box>hide @sm-width</layout:box>
    </layout:block>
    <layout:block md="1-5" styling="hide-md bg-concrete-dark">
        <layout:box>hide @md-width</layout:box>
    </layout:block>
    <layout:block md="1-5" styling="hide-lg bg-asphalt-light">
        <layout:box>hide @lg-width</layout:box>
    </layout:block>
    <layout:block md="1-5" styling="hide-xl bg-asphalt">
        <layout:box>hide @xl-width</layout:box>
    </layout:block>
</layout:grid>

<layout:grid>
    <layout:block md="1-5" styling="show-xs bg-pink-light">
        <layout:box>show @xs-width</layout:box>
    </layout:block>
    <layout:block md="1-5" styling="show-sm bg-pink">
        <layout:box>show @sm-width</layout:box>
    </layout:block>
    <layout:block md="1-5" styling="show-md bg-pink-dark">
        <layout:box>show @md-width</layout:box>
    </layout:block>
    <layout:block md="1-5" styling="show-lg bg-lavender">
        <layout:box>show @lg-width</layout:box>
    </layout:block>
    <layout:block md="1-5" styling="show-xl bg-lavender-dark">
        <layout:box>show @xl-width</layout:box>
    </layout:block>
</layout:grid>
```

## Alignments

Default (Stretch)

<img src="https://mintcdn.com/lucidworks/vACLe5BtgzmMoCXX/assets/images/app-studio/as-examples/gallery/grid10.png?fit=max&auto=format&n=vACLe5BtgzmMoCXX&q=85&s=b5f4669d6f8ef96a5ce4eef7d4575822" alt="Example" width="1271" height="173" data-path="assets/images/app-studio/as-examples/gallery/grid10.png" />

Align All Items Top (`.tk-rgrid-align-top`)

<img src="https://mintcdn.com/lucidworks/vACLe5BtgzmMoCXX/assets/images/app-studio/as-examples/gallery/grid11.png?fit=max&auto=format&n=vACLe5BtgzmMoCXX&q=85&s=0d69739ea7bda0c19f732ef28fbf926d" alt="Example" width="1271" height="173" data-path="assets/images/app-studio/as-examples/gallery/grid11.png" />

Align All Items Bottom (`.tk-rgrid-align-bottom`)

<img src="https://mintcdn.com/lucidworks/vACLe5BtgzmMoCXX/assets/images/app-studio/as-examples/gallery/grid12.png?fit=max&auto=format&n=vACLe5BtgzmMoCXX&q=85&s=a81d718f9aa958f2a1fc002276d7208c" alt="Example" width="1271" height="173" data-path="assets/images/app-studio/as-examples/gallery/grid12.png" />

Align All Items Middle (`.tk-rgrid-align-middle`)

<img src="https://mintcdn.com/lucidworks/vACLe5BtgzmMoCXX/assets/images/app-studio/as-examples/gallery/grid13.png?fit=max&auto=format&n=vACLe5BtgzmMoCXX&q=85&s=c66890c27b2bec542f183cf8cbb4a02c" alt="Example" width="1271" height="173" data-path="assets/images/app-studio/as-examples/gallery/grid13.png" />

Stretch All Items (`.tk-rgrid-align-stretch`)

<img src="https://mintcdn.com/lucidworks/vACLe5BtgzmMoCXX/assets/images/app-studio/as-examples/gallery/grid14.png?fit=max&auto=format&n=vACLe5BtgzmMoCXX&q=85&s=57c20a578e4a51b8450e075574697a4e" alt="Example" width="1271" height="173" data-path="assets/images/app-studio/as-examples/gallery/grid14.png" />

Item Alignment Overrides

<img src="https://mintcdn.com/lucidworks/vACLe5BtgzmMoCXX/assets/images/app-studio/as-examples/gallery/grid15.png?fit=max&auto=format&n=vACLe5BtgzmMoCXX&q=85&s=3c6bcd5ab91b359390ecbd2c710a3a63" alt="Example" width="1271" height="173" data-path="assets/images/app-studio/as-examples/gallery/grid15.png" />

## Justify Items

Default, Align items to the start (`.tk-rgrid-justify-start`)

<img src="https://mintcdn.com/lucidworks/vACLe5BtgzmMoCXX/assets/images/app-studio/as-examples/gallery/grid16.png?fit=max&auto=format&n=vACLe5BtgzmMoCXX&q=85&s=419b93e565d67eae26bc3448d081ff70" alt="Example" width="1271" height="77" data-path="assets/images/app-studio/as-examples/gallery/grid16.png" />

Align items to the end of the container (`.tk-rgrid-justify-end`)

<img src="https://mintcdn.com/lucidworks/vACLe5BtgzmMoCXX/assets/images/app-studio/as-examples/gallery/grid17.png?fit=max&auto=format&n=vACLe5BtgzmMoCXX&q=85&s=59a4c27ceddb13edba822fb1372f35be" alt="Example" width="1271" height="77" data-path="assets/images/app-studio/as-examples/gallery/grid17.png" />

Center items (`.tk-rgrid-justify-center`)

<img src="https://mintcdn.com/lucidworks/vACLe5BtgzmMoCXX/assets/images/app-studio/as-examples/gallery/grid18.png?fit=max&auto=format&n=vACLe5BtgzmMoCXX&q=85&s=857b83bca80f725cab508ac4b0d1c22c" alt="Example" width="1271" height="77" data-path="assets/images/app-studio/as-examples/gallery/grid18.png" />

Even spacing around items (`.tk-rgrid-justify-around`)

<img src="https://mintcdn.com/lucidworks/vACLe5BtgzmMoCXX/assets/images/app-studio/as-examples/gallery/grid19.png?fit=max&auto=format&n=vACLe5BtgzmMoCXX&q=85&s=8681d43c93ae57a0d0f10e0abc5310ad" alt="Example" width="1271" height="77" data-path="assets/images/app-studio/as-examples/gallery/grid19.png" />

Even spacing between items (`.tk-rgrid-justify-between`)

<img src="https://mintcdn.com/lucidworks/vACLe5BtgzmMoCXX/assets/images/app-studio/as-examples/gallery/grid20.png?fit=max&auto=format&n=vACLe5BtgzmMoCXX&q=85&s=58fe2665d386f5876672f8438fe848bc" alt="Example" width="1271" height="77" data-path="assets/images/app-studio/as-examples/gallery/grid20.png" />

Combination

<img src="https://mintcdn.com/lucidworks/vACLe5BtgzmMoCXX/assets/images/app-studio/as-examples/gallery/grid21.png?fit=max&auto=format&n=vACLe5BtgzmMoCXX&q=85&s=68d17476d8c0c7be3a334f7d7b278115" alt="Example" width="1271" height="141" data-path="assets/images/app-studio/as-examples/gallery/grid21.png" />

## Container Direction

Row - Default (`.tk-rgrid-direction-row`)

<img src="https://mintcdn.com/lucidworks/vACLe5BtgzmMoCXX/assets/images/app-studio/as-examples/gallery/grid22.png?fit=max&auto=format&n=vACLe5BtgzmMoCXX&q=85&s=04d47105f45795d373445456c20468dd" alt="Example" width="1271" height="77" data-path="assets/images/app-studio/as-examples/gallery/grid22.png" />

Row Reverse (`.tk-rgrid-direction-row-reverse`)

<img src="https://mintcdn.com/lucidworks/vACLe5BtgzmMoCXX/assets/images/app-studio/as-examples/gallery/grid23.png?fit=max&auto=format&n=vACLe5BtgzmMoCXX&q=85&s=f812c4130aed5ecf8e78b1aff13f2408" alt="Example" width="1271" height="77" data-path="assets/images/app-studio/as-examples/gallery/grid23.png" />

Column (`.tk-rgrid-direction-col`)

<img src="https://mintcdn.com/lucidworks/vACLe5BtgzmMoCXX/assets/images/app-studio/as-examples/gallery/grid24.png?fit=max&auto=format&n=vACLe5BtgzmMoCXX&q=85&s=c83d3cd2297600cceb3d119ba5d22515" alt="Example" width="1271" height="385" data-path="assets/images/app-studio/as-examples/gallery/grid24.png" />

Column Reverse (`.tk-rgrid-direction-col-reverse`)

<img src="https://mintcdn.com/lucidworks/vACLe5BtgzmMoCXX/assets/images/app-studio/as-examples/gallery/grid25.png?fit=max&auto=format&n=vACLe5BtgzmMoCXX&q=85&s=2c798a59c0df39b8eace28306fc0e61a" alt="Example" width="1271" height="385" data-path="assets/images/app-studio/as-examples/gallery/grid25.png" />

## Offsets

<img src="https://mintcdn.com/lucidworks/vACLe5BtgzmMoCXX/assets/images/app-studio/as-examples/gallery/grid26.png?fit=max&auto=format&n=vACLe5BtgzmMoCXX&q=85&s=cc1e50fc88bf4a119097369131051cdc" alt="Example" width="1271" height="192" data-path="assets/images/app-studio/as-examples/gallery/grid26.png" />
