Skip to main content

Design system components

CategoryFilter

Filter pill row for list pages (today the work index; the blog archive uses BlogCategoryFilter). Multiple visual treatments (pills, underline, minimal) for different surface densities.

Status: stable. Group: navigation. Markdown version: /design-system/components/category-filter.md

When to use

Pill-row filter for list pages: one selectable category set with visual treatments per surface (today the work index; the blog archive uses BlogCategoryFilter). Selection state lives in the parent.

When not to use

  • Do not use as primary navigation; CategoryFilter is a UI control, not a nav surface; use NavLink for routes.
  • Do not stack two filter rows when one composite control would do; readability collapses.

Look-alikes

  • BlogCategoryFilter: Do not use this for generic list pages; that is CategoryFilter.
  • NavLink: Do not use as primary navigation; CategoryFilter is a UI control, not a nav surface; use NavLink for routes.

Props

CategoryFilter props
PropTypeDefaultDescriptionRequired
categoriesCategoryOption[]noneArray of category options.Yes
activeCategorystringnoneCurrently active category value (single mode)No
onCategoryChange(category: string) => voidnoneCallback when category changes (single mode)No
multiplebooleanfalseLets several chips stay pressed at once. Pressing a chip toggles it, pressing the allValue chip clears the selection, and the collapsible row stays open while picking.No
activeCategoriesstring[][]Pressed values in multiple mode; an empty array presses the allValue chip.No
onCategoriesChange(categories: string[]) => voidnoneCalled with the new pressed values in multiple mode.No
allValuestringallValue of the chip that clears the selection in multiple mode. Defaults to "all".No
classNamestringnoneCustom className.No
size"sm" | "md" | "lg"mdSize variant.No
variant"pills" | "underline" | "minimal"pillsStyle variant.No
collapsiblebooleanfalseCollapse to the active chip and a disclosure button; expanding shows every chip and picking one collapses back to it.No
disclosureLabelstringnoneAccessible name of the disclosure button; defaults to the translated "All categories".No
groupLabelstringnoneAccessible name of the filter group; defaults to the translated "Filter by category" (categoryFilterGroupLabel).No

Variants

  • Available variants: pills, underline, minimal (default pills).
  • Available sizes: sm, md, lg (default md).

Invalid combinations

The contract records no invalid combinations.

Keyboard

CategoryFilter keyboard behaviour
KeyBehaviour
TabMoves between filter buttons.
Enter / SpaceActivates the focused filter.
Enter / SpaceOn the disclosure button (collapsible only): expands or collapses the chip row; picking a chip collapses it again.

Rules

Every item under When not to use is a MUST NOT. MUST and SHOULD follow RFC 2119.

CategoryFilter rules
LevelRuleHow it is checked
MUSTARIA: Renders a role=group named by groupLabel, or by the translated 'Filter by category' (categoryFilterGroupLabel) when it is not passed.Not yet verified: no evidence record. WCAG 4.1.2.
MUSTARIA: The active filter sets aria-pressed='true' on a toggle button (not aria-current) because the filter is a UI control, not a navigation target; exactly one is pressed at a time (single-select).Not yet verified: no evidence record. WCAG 4.1.2.
MUSTARIA: With collapsible, a leading disclosure button named by disclosureLabel (default: the translated 'All categories') carries aria-expanded. It has no aria-controls, because it sits inside the group it would point at.Not yet verified: no evidence record. WCAG 4.1.2.
MUSTRequired stories produce no axe violations at the configured severity.Automated by npm run test:stories:matrix:ci. WCAG 2.5.8.
MUSTThe accessibility tree (role, name, state) matches the committed snapshot for every required story.Automated by npm run test:stories:matrix:ci. WCAG 1.3.1, 4.1.2.
MUSTThe component remains legible and operable under a real browser forced-colors: active pass.Automated by npm run test:stories:hc.
MUSTEvery documented keyboard interaction works as specified.Not yet verified: no evidence record. WCAG 2.1.1, 2.1.2.
MUSTA human completed an end-to-end accessibility review of this component.Manual review, last on 2026-11-04.

Install and import

  • Install: npm install @digitaltableteur/react (version 0.9.1, restricted access on npm).
  • Import: import { CategoryFilter } from "@digitaltableteur/react";
  • Entry point: @digitaltableteur/react/patterns exports it too.
  • Styles: import @digitaltableteur/react/style.css once at the app boundary.
  • Also available as the custom element <dt-category-filter>; see the custom elements manifest.