Faceted Filter
ProNewA filter for one field with fixed values: counts beside each value, a search for long lists and the selection shown on the button.
Installation
pnpm dlx shadcn@latest add @viewport/faceted-filter
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 |
|---|---|---|
| title* | stringThe field being filtered, e.g. "Status". | — |
| options* | FacetOption[] | — |
| value* | string[]The selected values. | — |
| onValueChange* | (value: string[]) => void | — |
| searchable | booleanShow a search field above the options. Defaults to on for more than seven options. | — |
| className | string | — |
Accessibility
- Options are checkboxes in a named group.
- The button states the field and what is selected.
- The panel returns focus to the button when it closes.