Filtering
Components: FilterDropdown, FilterDropdownTrigger, FilterDropdownContent, FilterDropdownOption, FilterCascade, FilterCascadeTrigger, FilterCascadeContent, FilterCascadeCheckboxItem
+15 more
FilterInput, SearchInput, PageToolbar, Select, SelectInput, SelectSearchInput, SegmentedTabs, SegmentedControl, NumericBadge, Table, TableEmptyState, EmptyState, Dialog, Field, Button
Pick the control by the shape of the values; every filter applies on pick.
When to use
There is no FilterBar, PageFilters or Combobox (use Select + useSelectSearch), and no onApply prop.
Rules
Filter bar layout
PageToolbarowns the 24px gutter and 12px gap. Never addgap-*,px-*orpy-*to it.- Wrap
SearchInputand the filters in one<div className='flex items-center gap-8'>. SearchInputisw-[320px]in a toolbar,flex-1in a dialog.- A view toggle goes last with
className='ml-auto'. - Never set a width on filter triggers; they hug their text up to 180px.
- Never stack two
SegmentedTabsin one toolbar.
FilterDropdown
- Always give it a
label; it names the trigger and aria-label. - If the attribute is exclusive, use
allLabel(«All …» resets). If values combine, usemultiple(OR-ed). - Build
collectionwithcreateListCollection({ items, groupBy }). - Render options from
useFilterDropdown().groupsin a child component so they follow the search. details.valueof[]means unset. Pass counts ashint.- Never put
FilterDropdownin a form or add an Apply button to a filter menu.
FilterCascade
- Import all cascade parts from
@wallarm-org/design-system/FilterCascade, never the root. - Build
collectionwithcreateFilterCascadeCollection(items, accessors); plain{ value, label, children }items need no accessors. - If a level loads on demand, pass
loadChildrenand mark parentshasChildren. If a parent is pickable, passparentLabel. - If the menu needs a toggle ("Own only"), use
FilterCascadeCheckboxIteminFilterCascadeSection; you keep its state. - Never leave a description empty; show "No policies" for zero.
FilterInput
- Pass
fields(name,label,type,values) andvalue/onChange(ExprNode | null). Its menus and chips are built in.
Searchable select
- Put
SelectSearchInputinSelectHeader, wired touseSelectSearch. PassfilteredCollectiontoSelectand render it, so arrow keys skip hidden options. - If the menu must match the trigger, pass
positioning={{ sameWidth: true }}andSelectPositioner className='min-w-full max-w-full'; otherwise it is 240–320px. - Option icons: set
iconon each item. - For several values use
SelectInput multiple.SelectButtonTagis a trigger, not a chip list.
Picker dialog
- Use
Dialog width={960}; there is noDIALOG_SIZES. - Dialog parts own the 24px gutter. Never pad them.
DialogBodyhas noclassName: putflex flex-col gap-8on a child div, search and tabs inflex items-center gap-12. - Pass
getRowIdso selection survives search and paging. - Primary is
disabled"Add users" until rows are picked, then "Add 1 user", "Add 3 users".
Examples
A filter bar over a table: search, a multiple and a single filter, a scope chip, and the view toggle last.
Every pick applies at once. When the filters match nothing, the table offers "Reset filters", which clears the search and every filter.
From eight options a filter menu gets a search, and its options follow the query.
Options are grouped by deployment and carry attack counts. On reopen, picked options are pinned under «Selected»; a query with no match shows an empty message and keeps the menu open.
A scope chip whose applications load on demand and whose deployments can be picked.
Each option shows its policy count, "No policies" for zero. ✕ on the trigger returns to every scope, not one level up.
A searchable select in a form, with the menu matching the trigger.
A settings field saves on pick, with no Save button. A query with no match shows
SelectEmptyState and keeps the menu open.
A picker dialog whose primary counts the selection: disabled "Add users", then "Add 2 users".
Search and status tabs sit over a selectable Table. Picked rows stay picked while the search
changes, because rows are keyed by getRowId.