Components · Layout
Stack
Lays children out vertically (default) or horizontally. Horizontal stacks wrap on narrow screens.
ExamplesLink to this section
apiwebbreaking
Show JSONHide JSON
{
"version": 1,
"root": "stack",
"elements": {
"stack": {
"type": "Stack",
"props": { "direction": "horizontal", "gap": "sm" },
"children": ["api", "web", "breaking"]
},
"api": { "type": "Badge", "props": { "label": "api" } },
"web": { "type": "Badge", "props": { "label": "web", "tone": "info" } },
"breaking": {
"type": "Badge",
"props": { "label": "breaking", "tone": "danger" }
}
}
}Stacks lay children out top to bottom by default.
Use gap to set the space between them.
Show JSONHide JSON
{
"version": 1,
"root": "stack",
"elements": {
"stack": {
"type": "Stack",
"props": { "gap": "lg" },
"children": ["first", "second"]
},
"first": {
"type": "Text",
"props": { "text": "Stacks lay children out top to bottom by default." }
},
"second": {
"type": "Text",
"props": {
"text": "Use gap to set the space between them.",
"tone": "muted"
}
}
}
}PropsLink to this section
Generated from the zod schema the server validates with. Unknown props are ignored with a warning. Any prop can also be a dynamic value such as { "$state": "/path" }; it is checked again once it resolves.
| Prop | Type | Limits and defaults |
|---|---|---|
| direction | "vertical" | "horizontal" | — |
| gap | "none" | "sm" | "md" | "lg" | — |
| align | "start" | "center" | "end" | "stretch" | — |
RulesLink to this section
- Horizontal stacks wrap on narrow screens.
ChildrenLink to this section
Stack shows its children, in order.
It emits no events.