How to build an accessible Filter in React

Wraps buttons in a role="group" so screen readers announce the group label; each button uses aria-pressed to communicate selected state without relying on color alone

When to use a Filter

When not to use it

Keyboard interactions

Role group, verified at WCAG 2.2-AA.

Common mistakes

Avoid: <Filter options={statusOptions} onChange={navigate} />

Prefer: <Tabs items={statusTabs} />

Filter is for narrowing visible content, not routing between views

Example

<Filter
  options={[
    { label: 'All', value: 'all' },
    { label: 'Active', value: 'active' },
    { label: 'Archived', value: 'archived' },
  ]}
  aria-label="Filter by status"
/>

See the full Filter reference →