---
title: "Grid"
description: "Responsive grid."
---

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

# Grid

```gistui
root = Grid(Stat("Revenue", "$1.2M", "+8%"), Stat("Customers", "3,410", "+2.1%"), Stat("Churn", "1.8%", "-0.4pt", invert), cols:3)
```

A grid collapses to fewer columns on narrow screens by itself.

## Signature

This is the line a model reads in the system prompt.

```gistui
Grid(...children, cols:num, gap:Gap)
```

- **Group:** Layout
- **Children:** Yes: any component or text
- **Positional arguments:** none

## Props

| Prop | Type | How to write it | Notes |
|---|---|---|---|
| `cols` | number | named: `cols:…` | Default `3`. columns on wide screens (1–6) |
| `gap` | `none` · `xs` · `sm` · `md` · `lg` · `xl` | named: `gap:…` | Also accepts `small`, `medium`, `large`. |

## Use your own component

Keep the name and schema, swap what is drawn. The prompt and the model's output do not change.

### React

```tsx
import { ui } from "@gistui/react/ui";

const lib = ui.extend({ Grid: MyGrid });
<GistUI library={lib} stream={response.body} />;
```
### Vue

```vue
<GistUI :source="answer" :components="{ Grid: MyGrid }" />
```
### Svelte

```svelte
<GistUI source={answer} components={{ Grid: MyGrid }} />
```
### Solid

```tsx
<GistUI source={answer()} components={{ Grid: MyGrid }} />
```
### Vanilla

```ts
import { ui } from "@gistui/vanilla/ui";

const lib = ui.extend({ Grid: (ctx) => ({ el: myElement(ctx) }) });
```

See [Custom components](/docs/guides/custom-components/) for the full contract. Style hook: `[data-gistui="Grid"]`.

Source: https://gistui.com/docs/components/layout/grid/index.mdx
