A filter bar that only edits a value: a chip per field, a multi-select menu behind each, and nothing filtered for you. Keep the value in the URL, a store or on the server.
On this page
Used for
- Issue and task lists
- Filters kept in the URL
- Filters saved on the server
- Any list that is not a DataTable
Examples
Installation
npx knowns-ui@latest add filter-chipsFor Claude Code, Cursor or Codex: installs it and wires the props to your own data.
Paste this into your coding agent (Claude Code, Cursor, Codex). It checks your project, sets up the registry, runs the install and verifies it.
Install prompt
Install Filter Chips from Knowns UI into this project. Work step by step, show me each change, and ask before you edit files outside this project.
Context: Knowns UI (https://ui.knowns.dev) is a shadcn registry. Items land in the project as source files. Docs: https://ui.knowns.dev/docs/filter-chips
1. Check the project first. Stop and tell me if any of these is missing:
- React 19 and Tailwind CSS v4.
- A components.json at the project root. If there is none, ask me before running `npx knowns-ui@latest init --no-key` (it runs shadcn init when needed, then adds the registries).
2. Run:
```bash
npx knowns-ui@latest add filter-chips
```
It writes these files:
- lib/knowns/run.ts
- lib/knowns/json.tsx
- lib/knowns/status.ts
- lib/knowns/tone.ts
- lib/knowns/types.ts
- lib/knowns/use-abortable.ts
- lib/knowns/utils.ts
- lib/knowns/motion.tsx
- lib/knowns/motion-utils.ts
- components/ui/knowns/use-floating.ts
- components/ui/knowns/tooltip.tsx
- components/ui/knowns/tooltip-utils.ts
- components/ui/knowns/avatar.tsx
- components/ui/knowns/spinner.tsx
- components/ui/knowns/button.tsx
- components/ui/knowns/dialog.tsx
- components/ui/knowns/kbd.tsx
- components/ui/knowns/field-class.ts
- components/ui/knowns/textarea.tsx
- components/ui/knowns/chat-composer/use-autosize.ts
- components/ui/knowns/input.tsx
- components/ui/knowns/menu.tsx
- components/ui/knowns/tag.tsx
- components/ui/knowns/combobox.tsx
- components/ui/knowns/popover.tsx
- components/ui/knowns/filter-chips.tsx
and installs these npm packages: clsx@^2.1.1, tailwind-merge@^3.7.0, class-variance-authority@^0.7.1.
3. While it runs:
- It also adds a few @keyframes (all named kn-*) to the global CSS file (globals.css or the file components.json points at). Let it: they only add animations.
- If it asks to overwrite files under lib/knowns/: these are shared by every Knowns UI item. List them, say whether I changed them (check git), and ask me before you answer.
- If it asks to overwrite any other file, show me the diff and ask me.
4. Verify:
- Every file in the list above exists.
- The project type-checks (for example `npx tsc --noEmit`) and the dev build has no new errors.
5. Use it: follow the examples and props on https://ui.knowns.dev/docs/filter-chips, and ask me if anything about my data is unclear.
If the Knowns UI MCP server is connected (https://ui.knowns.dev/docs/ai-and-mcp), use get_component({ name: "filter-chips" }) or search_docs for details.
Finish with a short summary: the files you added or changed, the packages you installed, and anything I still need to do.Collapsed
Props
- fields
FilterField[]- { id, label, icon?, options, multiple?, plural? }. Options are { value, label, icon?, avatar?, keywords? }; avatar is a photo URL or your own node.
- value
Record<string, string[]>- Field id to the chosen option values. A field without values is not active. Unknown ids and values are ignored.
- onChange
(next: FilterValue) => void- Called with the whole new value. Empty fields are removed from it.
- collapsed
boolean|"auto"- Default
"auto" - true folds the empty fields into one + Filter menu; false always shows a ghost chip per field. auto folds below 520px or with more than five empty fields.
- searchFrom
number- Default
8 - A menu with more options than this gets a search box.
- addLabel
string- Default
"Filter" - The label of the + button when folded.
- multiple (field)
boolean- Default
true - false picks one value and closes the menu.
- plural (field)
string- Default
"selected" - What two or more values are called on the chip: "2 people".
- Keyboard
-- Chips are in the tab order. Enter or Space opens a menu; arrows, Home, End, typeahead move; Space or Enter toggles; Esc closes. Backspace or Delete on a chip clears it.
- Motion
-- A chip fades in over 120ms. Menus use the kit's fade. Nothing animates layout.
| Prop | Type | Default | Description |
|---|---|---|---|
| fields | FilterField[] | - | { id, label, icon?, options, multiple?, plural? }. Options are { value, label, icon?, avatar?, keywords? }; avatar is a photo URL or your own node. |
| value | Record<string, string[]> | - | Field id to the chosen option values. A field without values is not active. Unknown ids and values are ignored. |
| onChange | (next: FilterValue) => void | - | Called with the whole new value. Empty fields are removed from it. |
| collapsed | boolean | "auto" | "auto" | true folds the empty fields into one + Filter menu; false always shows a ghost chip per field. auto folds below 520px or with more than five empty fields. |
| searchFrom | number | 8 | A menu with more options than this gets a search box. |
| addLabel | string | "Filter" | The label of the + button when folded. |
| multiple (field) | boolean | true | false picks one value and closes the menu. |
| plural (field) | string | "selected" | What two or more values are called on the chip: "2 people". |
| Keyboard | - | - | Chips are in the tab order. Enter or Space opens a menu; arrows, Home, End, typeahead move; Space or Enter toggles; Esc closes. Backspace or Delete on a chip clears it. |
| Motion | - | - | A chip fades in over 120ms. Menus use the kit's fade. Nothing animates layout. |
What it handles
- 01Edits one plain object, field id to the chosen values, and never touches your rows: filter on the client, in the URL or on the server.
- 02Shows an empty field as a ghost + chip and an active one as Field is Value with a clear button, in the same place, so nothing jumps.
- 03Opens a multi-select menu per field with search once there are more than eight options, avatars for people and arrows, Home, End and typeahead.
- 04Folds the ghosts into one + Filter menu when the bar is narrow or you ask for it, and shows Clear all from two active chips.
- 05Ignores values the options no longer know, so a stale link cannot show a chip you cannot clear.
- 06Keeps every chip in the tab order, clears one with Backspace or Delete, and names each chip in full for screen readers.
States
- Chip appears
- Fades in; the row does not move
- 120ms, ease-out
- Menu opens
- The kit's floating fade
- 180ms, ease-out
- Row hover and focus
- Background fades in
- 120ms, ease-out
- Reduced motion
- Nothing fades
- 0ms
| State | What moves | Timing |
|---|---|---|
| Chip appears | Fades in; the row does not move | 120ms, ease-out |
| Menu opens | The kit's floating fade | 180ms, ease-out |
| Row hover and focus | Background fades in | 120ms, ease-out |
| Reduced motion | Nothing fades | 0ms |
Works with
When to use
When to use
- Filters for a list of issues, tasks or records that live in the URL or on the server.
- A filter bar next to a list you render and filter yourself.
When not to use
- Filters tied to the rows of a table, with counts per value: use Data Table.
- Picking one value for a form field: use Combobox.
- Two or three always-on toggles: use Segmented Control.
Using with AI
Use Copy page for AI above to give your assistant this page, Copy prompt under the install command to have it installed and wired to your data, or connect the Knowns UI MCP server and just ask:
- Add the Knowns UI Filter Chips to my app and wire it to my own data.
- I need filters for a list of issues, tasks or records that live in the URL or on the server. Set that up with the Knowns UI Filter Chips.
- Which Filter Chips props do I need for a minimal setup? Show me a short example.
With the server connected, your assistant calls get_component({ name: "filter-chips" }) and search_docs({ query: "filter chips" }).