Appearance
Filter panel
A pane beside a list where people narrow the results with filters.
filters-filtersbase--defaultOpen in Storybook ↗When to use
- A list whose entity type has filters, such as the library or the list of saved searches.
When not to use
- Searching on one term across the list: use the list's search.
- Choosing a value for a field: use a dropdown or the entity picker.
Anatomy
- Filters button: in the list band, a secondary-style button with a funnel, Filters and a count chip when filters are active. It opens and closes the pane.
- Pane: a
--filter-pane-widthcolumn at the left of the results panel. Its top row is level with the list band (--list-band-pad) and holds the Filters button while the pane is open. The rest scrolls. - Actions: Clear all (secondary, ✕) and Apply filter(s) (primary, full width), then the saved searches menu where saved searches are on, then an Add filter autocomplete for filters that are not shown by default.
- Section: one per filter. The header shows the filter's name, an optional help icon with a tooltip and a chevron (⌄ closed, ⌃ open).
- Matcher: inside an open section. With more than one way to match, the mode (contains text, is exactly, …) sits as a prefix inside the input box. Checkbox lists, two-field ranges and sliders stack under the mode instead.
- Clear filter: a small link under an active section.
Variants
| Variant | Where | Looks like |
|---|---|---|
| Pane | from 48rem up | a column beside the results |
| Sheet | below 48rem | a sheet from the bottom over a dimmed page (--sheet-radius); tapping the dimmed page closes it |
| Filter type | Default matcher |
|---|---|
| Text | contains text |
| Selection | is any of, with suggestions |
| Date, number, yes/no | is exactly |
A filter's configuration can change its default matcher, limit which matchers it offers and rename them.
States
| State | What you see | Trigger |
|---|---|---|
| Closed section | chevron ⌄, matcher hidden | — |
| Open section | chevron ⌃, matcher below the header | clicking the header, Enter or Space |
| Active section | header in --color-accent-light with --color-accent-ink; Clear filter link; count on the Filters button | the filter has a value |
| Pane open | Filters button with an accent border | clicking Filters |
| Paused | filters hidden; opening them ends the search | a simple search is running |
filters-filtersbase--activeOpen in Storybook ↗filters-filterstoggle--statesOpen in Storybook ↗Filters apply on Apply filter(s) or Enter, not on every keystroke. Typing or ticking only makes a section active. Clearing is lighter: Clear filter clears one filter and applies at once, and Clear all clears every filter, closes all sections, removes an applied saved search and applies at once.
A section opens by itself when its filter becomes active. Changing a section's matcher clears its value.
Keyboard & accessibility
- Enter anywhere in the pane applies the filters.
- Section headers are focusable, with
role="button"andaria-expanded; Enter or Space opens or closes them. - The pane is a
complementarylandmark named Filters. - The Filters button has
aria-expandedandaria-controlspointing at the pane. Its name includes the count: Filters, 2 active. The count chip itself is hidden from assistive technology. - The matcher's mode is a dropdown and follows its keys.
Content
- Filter names are nouns from the data: Title, Year of publication.
- Matcher modes read as the middle of a sentence: Title contains textdragon.
- Translation keys:
filters.*, with the modes infilters.matcher-labels.*.
Related
Saved searches · Autocomplete · Dropdown · Checkbox · Button