FilterChips
The mock's dashed .chipf row (solid ink when on) as a radiogroup: one tab stop, arrows move and select.
import { FilterChips } from '@ergasti/bricks';Examples
Chips with counts
A single-choice group exposed as a radio group; the value type is inferred from the options.
Code
import { useState } from 'react';
import { FilterChips } from '@ergasti/bricks';
function Status() {
const [value, setValue] = useState<'all' | 'active' | 'paused'>('all');
return (
<FilterChips
label="Status"
value={value}
onChange={setValue}
options={[{ value: 'all', label: 'All', count: 304 }, { value: 'active', label: 'Active', count: 301 }, { value: 'paused', label: 'Paused', count: 3 }]}
/>
);
}Props
Prop
Type
Design guidance
How the BRICKS design system uses FilterChips. Written in docs/content/components/FilterChips.md; the props above are read from the code, which wins where the two disagree.
A single-select row of dashed filter chips (solid ink when on), with optional counts; use it to switch a list between a few status or type filters.
It is the mock's .chipf row: "All · Active 301 · Paused 3 · Removed" above a list. It is a radiogroup with one tab stop, so arrows move and select. It appears in Brand › Activity log's toolbar (through ListToolbar), the PR Portal's source chips and wallet chips, gift status filters and MessageHistoryList; ListToolbar renders it from its chips prop.
Anatomy
- Group:
div.kit-chips[role=radiogroup], flex-wrap, 8px gap, named bylabel. - Chip:
button.kit-chipf[role=radio], padding 7px 14px (--chipf-pad), 1px dashed#C9CBD4border, radius 99, 13px / 600--ink-2. - Count (optional):
.kit-chipf-n, 11px, 6px after the label,dir="ltr". - On:
.kit-chipf.on, solid--inkborder and fill, white text.
Variants
| Setup | Look | When to use |
|---|---|---|
| Labels only | Dashed chips | Few filters with obvious size. |
With count | "Active 301" | When the count helps choose (statuses). |
States
| State | Trigger |
|---|---|
| Default | dashed outline. |
| Selected | value === option.value: ink fill, aria-checked="true", the only tab stop. |
| No match | value matches no option: no chip is selected and the first chip is the tab stop (as in Segmented), so Tab still reaches the group. Before 0.7.1 no chip was tabbable in this state; prefer passing one of the options' values (e.g. 'all'). |
| Pressed | :active scales to 0.98. |
| Focus-visible | kit focus ring. |
| Mobile (< 860px) | chips grow to 44px tall. |
Types
FilterOption<T> (options): { value, label, count? } per chip.
Usage
type Status = 'all' | 'active' | 'paused' | 'removed';
const [status, setStatus] = useState<Status>('all');
<FilterChips<Status> label="Status" value={status} onChange={setStatus} options={[
{ value: 'all', label: 'All' },
{ value: 'active', label: 'Active', count: 301 },
{ value: 'paused', label: 'Paused', count: 3 },
{ value: 'removed', label: 'Removed' },
]} />// Brand › Activity log: the chips through ListToolbar (it renders FilterChips from `chips`)
type Kind = 'all' | 'requests' | 'invites' | 'payouts';
const kinds: FilterOption<Kind>[] = [
{ value: 'all', label: 'All' }, { value: 'requests', label: 'Join requests' },
{ value: 'invites', label: 'Invites' }, { value: 'payouts', label: 'Payouts' },
];
const [kind, setKind] = useState<Kind>('all');
const [day, setDay] = useState('');
<>
<ListToolbar<Kind>
chips={{ label: 'Show', value: kind, options: kinds, onChange: setKind }}
date={{ label: 'Day', value: day, onChange: setDay }}
reset={{ active: kind !== 'all' || day !== '', onReset: () => { setKind('all'); setDay(''); } }}
actions={<Button onClick={exportCsv}>Export CSV</Button>}
/>
<ActivityLog events={events} status="ready" />
</>Where it appears
- In the v3 mocks: Brand › Activity log › filter chips (the
.chipfrow); PR Portal › list toolbars with source and wallet chips. - Library:
ListToolbardraws it fromchips;GiftStatusFilter, the challenge status filter andMessageHistoryList(library only, no mock screen) are built on it.
Guidelines
Do
- Keep to 2–6 chips; put "All" first.
- Use counts from the server, formatted as plain integers.
Don't
- Don't pass a
valuethat is not one of the options (a cleared filter as''): no chip shows as selected. Map "no filter" to an'all'option. - Don't use chips for multi-select; they are exclusive.
- Don't use them as navigation between pages; use
PillTabs.
RTL and Arabic
- Chips flow from the inline start; arrow keys follow visual direction in RTL.
- Counts are
dir="ltr". Arabic labels: "الكل", "نشط", "متوقف".
Tokens
--card, --ink, --ink-2, --chipf-pad, --focus-ring, --min-touch-target.
Accessibility
role="radiogroup"witharia-label; chips arerole="radio"witharia-checked.- Roving tab index: one Tab stop (the selected chip, or the first when
valuematches none); ←/→ (mirrored in RTL), ↑/↓, Home, End move and select. - A chip with a count is named "Active, 301" (
aria-label). - Touch: at ≤1024px each chip gets a 44px hit area (
::before), and under 860px the chips are 44px tall. On desktop they keep the mock's 35px.
Found in the source
- Roles in the markup:
radiogroup,radio. - ARIA attributes set:
aria-label,aria-checked. - It moves focus in code.
Read from the component's source and tests. See Accessibility for the patterns the library follows.
Related
Segmented: a compact two-to-four option switch inside a card header.PillTabs: tabs that swap panels.ListToolbar(chips): where the chips sit above a list.
See also: BulkBar · CopyLink · CreatorCell · DataTable
Source
src/kit/patterns/FilterChips.tsx (line 12) on GitHub.