Cluster
A horizontal flex row that wraps, for toolbars, tag lists, and inline action groups.
Live demo
Cluster lays its children out in a horizontal flex row that wraps onto new lines as space runs out, with a token-driven gap (0–8) between every item, including across wrapped rows. It vertically centers its children by default and exposes align and justify for finer control.
A nowrap flag pins everything to a single row when wrapping is unwanted. Like Stack it carries no chrome of its own, making it the natural home for button groups, badge and tag lists, breadcrumb trails, and any run of inline-ish boxes that should breathe consistently.
When to use
How this component composes with the rest of the set.
Props
5 props, straight from the manifest.
| Prop | Type | Default | Bindings | Description |
|---|---|---|---|---|
Anatomy
The named parts that make up the component, with their selectors.
root
The wrapping flex-row 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 arrange in a wrapping row.
Accessibility
Code
Wrapping row
Children flow left to right and wrap onto new lines, gapped consistently in both axes.
<xoji-cluster gap="2">
<xoji-button variant="solid" tone="accent">Save</xoji-button>
<xoji-button variant="outline" tone="neutral">Cancel</xoji-button>
</xoji-cluster>
<xoji-cluster gap="1" justify="between">
<xoji-badge tone="success">Active</xoji-badge>
<xoji-badge tone="info">Beta</xoji-badge>
<xoji-badge tone="warn">Limited</xoji-badge>
</xoji-cluster>
<script lang="ts">
import { Cluster, Button, Badge } from "@xoji/svelte";
</script>
<Cluster gap={2}>
<Button variant="solid" tone="accent">Save</Button>
<Button variant="outline" tone="neutral">Cancel</Button>
</Cluster>
<Cluster gap={1} justify="between">
<Badge tone="success">Active</Badge>
<Badge tone="info">Beta</Badge>
<Badge tone="warn">Limited</Badge>
</Cluster>
---
import { Cluster, Button, Badge } from "@xoji/astro";
---
<Cluster gap={2}>
<Button variant="solid" tone="accent">Save</Button>
<Button variant="outline" tone="neutral">Cancel</Button>
</Cluster>
<Cluster gap={1} justify="between">
<Badge tone="success">Active</Badge>
<Badge tone="info">Beta</Badge>
<Badge tone="warn">Limited</Badge>
</Cluster>