Toolbar
src/lib/components/ui/toolbar/
Purpose
The standard action strip. Beyond the visual chrome, it enforces the CTA presentation order so every toolbar in the product looks and reads the same:
Code
The whole CTA zone is pushed to the far right via ml-auto — CTAs are
always right-aligned whether or not left is used. left is the only
way to pin content to the far left (search bars, row counters, …).
Origin
Vendored — bits-ui Toolbar primitive + Primebrick structural
rules (groups/refresh/primary props, ToolbarDivider).
Usage
Code
Card (default) — full strip
Code
Each groups entry is auto-separated by a divider — a ButtonGroup is
always visually isolated from the rest.
Bare — embedded in a list/table header
Code
card={false} drops the border (keeps the muted chrome) — this is the
EntityListTable look, for toolbars embedded inside an already-framed
list/table area. card={true} gives the standalone bordered card.
Ordering contract
| Rule | Enforced by |
|---|---|
| Primary CTA(s) always rightmost, divider before | primary snippet |
| Refresh sits right before the primaries (ghost icon + label) | refresh prop |
| Every isolated island gets its own dividers | groups array |
| Section titles live outside the toolbar | — (layout convention) |
Props
| Prop | Type | Default | Description |
|---|---|---|---|
card | boolean | true | true = bg-muted/30 + border, compact padding; false = borderless bg-muted/30, looser padding (entity-list look). |
left | Snippet | — | Optional far-left zone (search, counters) — flex-1 min-w-0. |
groups | Snippet[] | [] | Control islands — each auto-separated by a divider. |
refresh | { onclick: () => void; loading?: boolean; disabled?: boolean } | — | Standard refresh button, right before primaries. |
primary | Snippet | — | Primary CTA(s) — always last (rightmost). |
children | Snippet | — | Free-form controls rendered first (leftmost zone). |
ToolbarDivider is exported separately for manual separators inside
children (h-6 w-px divider-primary-gradient).
Reference
Code
Next steps
- UI components — component inventory
- StatCard — KPI card (same card/bare convention)