A query people build from chips: + Filter picks a field, an operator and a value; each rule is a chip whose parts reopen that step. Rules combine with AND, live in the URL and filter rows in the browser.
Filters basic
Install
npx shadcn add @syncrobotic/filters Also installs: date-fns, lucide-react, @syncrobotic/cn, @syncrobotic/use-presence, @syncrobotic/button, @syncrobotic/calendar, @syncrobotic/command, @syncrobotic/input, @syncrobotic/number-field, @syncrobotic/popover
Overview
When to use
- A long list or grid with many columns worth filtering: robots, incidents, runs.
- Views people tune and share: the rules go in the URL.
Use something else
- A fixed set of known filters, laid out in a sheet or above a list: Filter form.
- One facet, one choice: Chip group.
- Text only: Search field.
More examples
States and real uses. Each example is also a Storybook story and a visual regression test.
Filters all field types
Filters URL synced
Filters empty
Filters many rules wrapping
Usage rules
- For a query people build themselves: any field, any number of rules. For a few fixed facets use Chip group or Filter form.
- Rules combine with AND, and the bar says so between the chips. There are no groups and no OR.
- Keep the rules in the URL with toSearchParams and fromSearchParams, so a filtered view can be shared and undone with Back.
- Show what the rules leave ("12 of 40 robots") next to the bar, in a polite live region.
- Every label is a prop; translate the operators too.
Changelog
- 0.23.22026-11-21Compiles with noUncheckedIndexedAccess, as strict products build it; behaviour unchanged.
- 0.23.12026-11-21The chip parts' click handlers are written on each button instead of being built in render, so the bar is safe under the React Compiler. No visible change.
- 0.23.02026-11-20
localeformats the options' counts.