Toolbar
The mock's .toolbar: search, chips, filters, then the actions (Export) pushed to the end. reset (user 16 Nov): one "Reset filters" button on every filtered list, shown only while something is set (a search, a chip, a select or a sort); it puts the list back to its first page and default order. BRICKS addition: sort is a slot after the filters for "Sort by" + the flip button (ListToolbar draws the whole v3 row from data).
import { Toolbar } from '@ergasti/bricks';Examples
Slots
Toolbar lays out nodes you build yourself: search, chips, filters, sort and actions; ListToolbar is the same row driven by data.
Code
import { useState } from 'react';
import { Button, FilterChips, Segmented, Toolbar } from '@ergasti/bricks';
function Slots() {
const [chip, setChip] = useState('all');
const [range, setRange] = useState('30');
return (
<Toolbar
search={<input placeholder="Search name or coupon" aria-label="Search" />}
chips={<FilterChips label="Status" value={chip} onChange={setChip} options={[{ value: 'all', label: 'All' }, { value: 'active', label: 'Active' }, { value: 'paused', label: 'Paused' }]} />}
filters={<Segmented label="Range" value={range} onChange={setRange} options={[['7', '7 days'], ['30', '30 days'], ['90', '90 days']]} />}
reset={{ active: chip !== 'all' || range !== '30', onReset: () => { setChip('all'); setRange('30'); } }}
actions={<Button size="sm">Export CSV</Button>}
/>
);
}A sort slot
sort sits after the filters, for your own "Sort by" control (ListToolbar draws one from data).
Code
import { useState } from 'react';
import { SelectBox, Toolbar } from '@ergasti/bricks';
function SortSlot() {
const [sort, setSort] = useState('sales');
return (
<Toolbar
search={<input placeholder="Search" aria-label="Search" />}
sort={<SelectBox id="toolbar-sort" label="Sort by" value={sort} options={[['sales', 'Sales'], ['name', 'Name']]} onChange={setSort} />}
/>
);
}Props
Prop
Type
Labels
Every word this component draws, in both languages. Override one per component and language with BricksProvider labels under the key toolbar, or with the component's own prop where it has one. A {name} is a value the component fills in.
| Key | English | Arabic |
|---|---|---|
reset | Reset filters | امسح الفلاتر |
Design guidance
How the BRICKS design system uses Toolbar. Written in docs/content/components/Toolbar.md; the props above are read from the code, which wins where the two disagree.
A slot-based toolbar row (search, chips, filters, sort, then actions and an optional "Reset filters" pushed to the end) for page rows that do not drive a list, such as Analytics' period row and Motivation's hint and request button; any toolbar above a list is ListToolbar.
It is the mock's .toolbar (flex, 10px gaps, 16px under it; 0 inside a Card). Inputs and selects inside it take the pill look (radius 99, min 200px). The brand book's rule: ListToolbar for every toolbar that drives a list (it draws search, chips, selects, a date, sort and reset from data, and resets the page); Toolbar only for a row with no list under it (the Analytics range + challenge + Export row above the chart, Motivation's hint line + "+ Request a challenge"). SortSelect is deprecated; use ListToolbar's sort.
Anatomy
- Row:
.kit-toolbar, flex-wrap, 10px gap, centred. - Slots in order:
search,chips,filters,sort. - End group:
.kit-toolbar-end,margin-inline-start: auto, 8px gap: the Reset button (when active) thenactions.
Variants
| Setup | When to use |
|---|---|
| Search only | Short lists. |
| Search + chips + filters + actions | Full list toolbar (0.1.x screens). |
reset | Any filtered list: "Reset filters" appears while something is set. |
States
| State | Trigger |
|---|---|
| Reset hidden | reset.active false or no reset. |
| Reset shown | reset.active true: small button with the reset icon. |
| Field focus | --rasp border + --focus-ring-field. |
| Narrow | slots wrap to new lines. |
Usage
// Brand › Motivation: hint + request button
<Toolbar
filters={<span className="kit-muted">Ask the TRNDR team for a challenge. They review it, may adjust it, and switch it on. Click a card for details.</span>}
actions={<Button variant="rasp" onClick={openRequest}>+ Request a challenge</Button>}
/>// Brand › Analytics: the period row above the chart (no list under it)
<Toolbar
filters={<>
<Segmented label="Range" value={range} onChange={setRange} options={[['7', '7 days'], ['30', '30 days'], ['90', '90 days']]} />
<SelectBox id="analytics-challenge" label="Challenge" hideLabel value={challenge} onChange={setChallenge} options={challengeOptions} />
</>}
actions={<Button onClick={exportCsv}>Export</Button>}
/>Where it appears
- In the v3 mocks: Brand › Motivation › hint line + "Request a challenge" button (BrandMotivation); Brand › Analytics › range
Segmented+ challenge select + Export (BrandAnalytics). - The mock draws the Activity log's chips, date and Export as a
.toolbartoo, but that row drives a list: build it withListToolbar(chips,date,actions). - Rows that drive a list (creators, coupons, PR lists) use
ListToolbar.
Guidelines
Do
- Use it for a page row with no list under it: a chart's period controls, a hint with a create button.
- Keep the order search → chips → filters → sort → actions.
Don't
- Don't use it above a list (Activity log, creators, coupons, PR lists): use
ListToolbar, which handles search, chips, selects, the date, sort and reset from data. - Don't pair it with
SortSelect(deprecated). - Don't put more than two actions at the end.
RTL and Arabic
- The end group uses
margin-inline-start: auto, so it moves to the left in RTL.
Tokens
--line, --card, --ink, --ink-3, --rasp, --focus-ring-field, --kit-chevron, --min-touch-target.
Accessibility
- Give every input and select a visible label or
aria-label. - Reset is a real button; focus stays predictable because it appears at the end.
Found in the source
- No roles, ARIA attributes or key handling are set in this component's own source; it renders native elements and the components it composes.
Read from the component's source and tests. See Accessibility for the patterns the library follows.
Related
ListToolbar: the v3 data-driven toolbar.FilterChips,Segmented,SortSelect: its parts.
See also: Icon · Button · SelectBox · BulkBar · CopyLink · CreatorCell · DataTable
Source
src/kit/patterns/Toolbar.tsx (line 14) on GitHub.