Facet Filter

A titled checkbox facet group for sidebar search filters in React. Each option can show a result count, and the selected values come back as an array.

src/registry/ui/facet-filter.tsx/r/facet-filter.json

Installation#

bash
npx shadcn@latest add @minidev/facet-filter

MiniDev UI is in the shadcn registry directory, so the short form works with no setup. Older CLI versions can use the full URL: npx shadcn@latest add https://ui.minidev.pro/r/facet-filter.json

Usage#

tsx
import { FacetFilter } from "@/components/ui/facet-filter"

export function Example() {
  return (
    <FacetFilter title="Status" value={facets} onChange={setFacets} options={[{ value: "open", label: "Open", count: 12 }, { value: "done", label: "Done", count: 40 }]} />
  )
}

API reference#

FacetFilter props
PropTypeDefault
titlestring"Status"
optionsFacet[]SAMPLE_OPTIONS
valuestring[]-
defaultValuestring[]-
onChange(value: string[]) => void-
classNamestring-

Dependencies#

npm

React only

Built from

Examples#

All form components

Learn more