ListToolbar
Slim result bar for filtered lists and directories: result count, page position and a sort note on the left; a view switch and sort control on the right.
Design intent
Every directory rebuilds the same row above its results: "42 events · Page 2 of 5" on the left, a grid/list SegmentedControl and a sort Select on the right. ListToolbar fixes that layout so the summary stays consistent and screen readers hear count changes.
npx @slipstream-ui/cli@latest add list-toolbar42 eventsPage 2 of 5Sorted by date, soonest first
view: grid · sort: date
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| count | number | — | Number of matching results; renders "{count} {countLabel}". |
| countLabel | string | 'results' | Noun for the result count. |
| position | ReactNode | — | Page or range position, e.g. "Page 2 of 5". |
| note | ReactNode | — | Muted note after the position, e.g. a "sorted by" line. |
| align | 'between' | 'start' | 'center' | 'end' | 'between' | Distribution of summary and controls. |
| children | ReactNode | — | Controls at the far end: SegmentedControl view switch, sort Select. |
Anti-patterns
validate_usage is the MCP tool that rejects these mistakes: the same list agents see over MCP and in the canonical markdown.
Don't put filter inputs in the bar
ListToolbar summarizes results; search fields and filter selects belong in FilterBar above it. Children is for the view switch and sort control only.
tsx// Avoid<ListToolbar><Input placeholder="Search…" /><Select … /></ListToolbar>// Prefer<FilterBar searchValue={q} onSearchChange={setQ}><Select … /></FilterBar><ListToolbar count={n}><SegmentedControl … /><Select … /></ListToolbar>
Accessibility
- The summary line is aria-live="polite" so result-count changes are announced.
- Give icon-only controls an aria-label; prefer SegmentedControl link mode for URL-backed view switching.
Content guidelines
Count label
- Name the collection being counted
- Use singular nouns for count=1 if the host needs it
Good examples
- events
- studios
Bad examples
- items
- results
Composition
Compose with SegmentedControl: Link-mode SegmentedControl is the canonical grid/list view switch
<ListToolbar …><SegmentedControl options={views} value={view} onValueChange={setView} /></ListToolbar>
Compose with Select: Sort control renders in children
<ListToolbar …><Select label="Sort" … /></ListToolbar>
Compose with FilterBar: FilterBar owns the input row above; ListToolbar owns the result summary below it
<FilterBar … /><ListToolbar … />{results}
Related components: FilterBar, SegmentedControl, Select, Pagination, EmptyState
Dependencies
What the registry installs alongside this component. Package imports already include these.
npm packages
- class-variance-authority
- clsx
- tailwind-merge
Browser support
| Browser | Tested versions |
|---|---|
| Chrome | 111+ (Mar 2023) |
| Edge | 111+ (Mar 2023) |
| Firefox | 121+ (Dec 2023) |
| Safari | 17.2+: macOS & iOS (Dec 2023) |
Slipstream components rely only on CSS custom properties, Flexbox/Grid, and ARIA, the everyday baseline of the last two years of evergreen releases. Anything newer is progressive enhancement: unsupported browsers keep full functionality with static behavior instead of animations.