When to use
Section titled “When to use”FilterBar sits above a list or table and lets users narrow the records: search by name, pick a status, a few categories, a switch such as “mine only”. Users see what is filtered from the chips and reset it in one click.
When not to use
Section titled “When not to use”- For a single field: one search box needs only TextInput or InputGroup.
- For many complex conditions: a query builder with logical grouping is not the job of FilterBar.
- To sort the data itself: sorting belongs in the table header.
- For in-page navigation: use Tabs to switch between views of the same data.
Anatomy
Section titled “Anatomy”- Root: a region named with
role="search". - Search (
FilterBar.Search): a text box with an icon; its label is visually hidden and the placeholder repeats it. - Fields (
FilterBar.Field): Select forselect, a popover checkbox group formulti-select, Toggle fortoggle. - More (
FilterBar.More): on narrow screens a button and a panel for the other fields. - Apply (
FilterBar.Apply): Apply and Reset inbatchmode. - Clear (
FilterBar.Clear): only when a filter is applied. - Chips (
FilterBar.Applied):"{field}: {value}"chips. - Result count (
FilterBar.ResultCount): “12 results”.
Behaviour
Section titled “Behaviour”- In
instantmode every change is reported at once throughonValueChange, and so is every keystroke in the search box. If typing starts a request, debounce the call yourself. - In
batchmode the draft stays local; Apply, Reset and Enter handle it. Removing a chip and clearing apply at once. - In a multi-select every chosen option is its own chip.
- “Clear filters” returns to
defaultValue; without it every field is emptied. After clearing, focus moves to the first control. - Removing the last chip also moves focus to the first control.
- While
loading, the result count becomes a placeholder and is not announced. - Below 1024 px the search stays in the row and the other fields go under “More filters”.
Guidelines
Section titled “Guidelines”Keep the common filters visible
Section titled “Keep the common filters visible”Keep the three or four most used filters in the row; leave the rare ones under “More filters”.
12 sonuç
Choose batch apply for expensive queries
Section titled “Choose batch apply for expensive queries”If every change starts a long query use batch; for light filtering instant feels smoother.
Content
Section titled “Content”- Make field labels short nouns: “Status”, “Category”, “Owner”.
- Keep the
searchlabel short, such as “Search”; let the placeholder say what is searched: “Search by name”. - Write options in sentence case and leave the “All” option alone; the library adds it.
- When writing to the URL, think about what search text can contain: do not keep searches with personal data in the URL. That decision is the app’s.