Preview
Loading preview…
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.
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.
import { ui } from "@gistui/react/ui";
const lib = ui.extend({ Grid: MyGrid });
<GistUI library={lib} stream={response.body} />;<GistUI :source="answer" :components="{ Grid: MyGrid }" /><GistUI source={answer} components={{ Grid: MyGrid }} /><GistUI source={answer()} components={{ Grid: MyGrid }} />import { ui } from "@gistui/vanilla/ui";
const lib = ui.extend({ Grid: (ctx) => ({ el: myElement(ctx) }) });See Custom components for the full contract. Style hook: [data-gistui="Grid"].