docs / patterns / toolbar
Toolbar
a horizontal bar over a working surface: groups of related controls on the left, a trailing actions cluster on the right, and it wraps instead of clipping.
intensity · structuresrsc · server
provenance
shaped from sisu-pluslayer
core / patternsintensity
structures · organizes a region, stays out of the contentcomposition
tops a table, board, or panel it acts onsmall controls only: sm buttons, badges, legend keys, count chipsnot navigation and not a page headerno solid buttons except the one primary action in ToolbarActionsa11y
role="toolbar" on the row, give it an aria-label · swatches and count dots are aria-hiddenjest-axelive demo · try it out
Computer Science
Mathematics
Physics
Linguistics
Philosophy
3unsaved
customize
maxcaps visible keys, rest collapse to +N
countat zero the chip renders nothing
tonesemantic tone for the count chip
labelthe noun after the number
usage
import { Toolbar, ToolbarActions, ToolbarCount, ToolbarLegend, ToolbarLegendItem } from "@usva-ui/react/patterns/toolbar";
import { Button } from "@usva-ui/react/primitives/button";
<Toolbar aria-label="timeline toolbar">
<ToolbarLegend>
<ToolbarLegendItem swatch="#8b5cf6">Computer Science</ToolbarLegendItem>
<ToolbarLegendItem swatch="#52c989">Mathematics</ToolbarLegendItem>
<ToolbarLegendItem swatch="#e0b341">Physics</ToolbarLegendItem>
<ToolbarLegendItem swatch="#6ea8fe">Linguistics</ToolbarLegendItem>
<ToolbarLegendItem swatch="#e0556b">Philosophy</ToolbarLegendItem>
</ToolbarLegend>
<ToolbarActions>
<ToolbarCount count={3}>unsaved</ToolbarCount>
<Button size="sm">Confirm</Button>
</ToolbarActions>
</Toolbar>props
| prop | type | default | notes |
|---|---|---|---|
| role | string | "toolbar" | override only when the bar is purely presentational. |
| ToolbarLegend · max | number | — | caps the visible keys; the rest collapse into a "+N" indicator. |
| ToolbarLegendItem · swatch | string | — | any CSS color, following StripeCard's stripeColor. unset falls back to a neutral token. |
| ToolbarCount · count | number | — | at zero the chip renders nothing, so callers stop guarding. |
| ToolbarCount · tone | "accent" | "accent-alt" | "success" | "warning" | "danger" | "accent" | semantic tone for the chip and its dot. |
get it
bun add @usva-ui/reactusage
import { Toolbar, ToolbarActions, ToolbarGroup } from "@usva-ui/react/patterns/toolbar";
import { Button } from "@usva-ui/react/primitives/button";
<Toolbar aria-label="projects toolbar">
<ToolbarGroup>
<Button size="sm" variant="ghost">Filter</Button>
</ToolbarGroup>
<ToolbarActions>
<Button size="sm">New</Button>
</ToolbarActions>
</Toolbar>