Stack
A vertical flex column with a token-driven gap, the primitive for stacking content.
Live demo
Stack lays its children out in a flex column with a consistent gap drawn from the --space scale. The gap prop (0–8) selects the spacing step, while align and justify control the cross- and main-axis distribution.
It carries no visual chrome of its own (no background, border, or color), so it composes cleanly inside cards, panels, and page shells. An inline flag switches it to an inline-flex column for embedding in running text or alongside other inline boxes.
When to use
How this component composes with the rest of the set.
Props
4 props, straight from the manifest.
| Prop | Type | Default | Bindings | Description |
|---|---|---|---|---|
Anatomy
The named parts that make up the component, with their selectors.
root
The flex-column container carrying the gap, align, and justify classes.
Tokens & coverage
What the component consumes, checked live against what the algorithm produces.
Live coverage check against the xoji-default register
(derive(xojiDefault, { anchors }) →
coverComponent(manifest, register)). Every token this component
consumes must be a key the algorithm produces.
--space-0
--space-1
--space-2
--space-3
--space-4
--space-5
--space-6
--space-7
--space-8
Slots
The children to stack vertically.
Accessibility
Code
Vertical stacking
Children flow top to bottom with a uniform, token-driven gap.
<xoji-stack gap="4">
<xoji-card>First</xoji-card>
<xoji-card>Second</xoji-card>
<xoji-card>Third</xoji-card>
</xoji-stack>
<xoji-stack gap="2" align="center">
<h2>Centered column</h2>
<p>Children stack vertically, centered on the cross axis.</p>
</xoji-stack>
<script lang="ts">
import { Stack, Card } from "@xoji/svelte";
</script>
<Stack gap={4}>
<Card>First</Card>
<Card>Second</Card>
<Card>Third</Card>
</Stack>
<Stack gap={2} align="center">
<h2>Centered column</h2>
<p>Children stack vertically, centered on the cross axis.</p>
</Stack>
---
import { Stack, Card } from "@xoji/astro";
---
<Stack gap={4}>
<Card>First</Card>
<Card>Second</Card>
<Card>Third</Card>
</Stack>
<Stack gap={2} align="center">
<h2>Centered column</h2>
<p>Children stack vertically, centered on the cross axis.</p>
</Stack>