FilterBar
July 6, 2026 · View on GitHub
Horizontal strip of active filter chips with an "Add filter" affordance and optional Save / Clear all actions. Sits under a TableToolbar or any filterable view.
Contract
<kp-filter-bar> renders one closable Badge chip per active filter and emits events for removal / add / save / clear. State lives outside — the component is purely presentational.
Each chip's label carries both the facet name and the value ("Status: Active", "Category: 3 selected"). For multi-value facets, format the label yourself — the chip itself is single-line.
API
KpFilterBarComponent
| Input | Type | Default | Description |
|---|---|---|---|
filters | KpFilterChip[] | [] | One chip per active filter |
showAddFilter | boolean | true | Render "+ Add filter" button (opens a picker in your app) |
showSaveFilter | boolean | false | Render "Save filter" ghost action |
showClearAll | boolean | true | Render "Clear all" — auto-hidden when there are no chips |
KpFilterChip
interface KpFilterChip {
id: string;
label: string; // "Status: Active"
color?: 'primary' | 'neutral' | 'success' | 'warning' | 'danger' | 'info';
}
Outputs
removeFilter(id: string)— chip close button clickedaddFilter()— "+ Add filter" clicked (open your filter picker)saveFilter()— "Save filter" clicked (persist the current set as a preset)clearAll()— "Clear all" clicked
Do / Don't
Do
- Give semantic chips a colour. A danger-red
Level: Errorchip reads faster than the generic neutral — usecolor: 'danger'for errors,successfor positive states,primaryfor a "pinned" facet. - Pair FilterBar with TableToolbar above. Toolbar's "Filters" button opens the picker; FilterBar shows the active state. Don't duplicate filter state in the toolbar dropdown.
- Wrap chips on narrow widths — the component already sets
flex-wrap: wrapwith arow-gap, so there's no horizontal scroll.
Don't
- Don't let chip labels grow past ~40 chars. If a facet has many values, summarise as
"Category: 3 selected"and show the list in a popover on hover. - Don't render a FilterBar with
showAddFilter=falseand no chips — there's nothing to interact with. Hide the whole component instead. - Don't emit
clearAllif the user only removed one chip; useremoveFilter(id)and let the consumer updatefilters.
References
- Figma:
FilterBarComponent Set on the 📐 Patterns page. - Storybook: https://gregnblack.github.io/kanso-protocol/?path=/docs/patterns-filterbar
- Source:
packages/ui/filter-bar/src/
Changelog
0.1.0— Initial release. Closable Badge chips, Add / Save / Clear ghost actions, per-chip colour.