Filter Bar
ProNewBuild a query one condition at a time. Each chip reads as a sentence whose operator and value are controls, for select, text and number fields.
Installation
pnpm dlx shadcn@latest add @viewport/filter-bar
First time? Add the @viewport registry to components.json. Setup takes one minute.
Usage
The code behind the preview above comes with Truffle Pro.
Props
| Prop | Type | Default |
|---|---|---|
| fields* | FilterField[]The fields that can be filtered. | — |
| value* | Filter[]The filters, in the order they were added. | — |
| onValueChange* | (filters: Filter[]) => void | — |
| className | string | — |
Accessibility
- Every part of a chip is a named button: operator, value and remove.
- A new condition opens its value editor and moves focus into it.
- A condition left without a value is removed instead of filtering to nothing.
- Respects prefers-reduced-motion.