Forms

Faceted filter.

Search grouped choices, select whole groups and keep a compact filter summary.

LIVE PREVIEWTry it. It works.

Install the source

Terminal
npx shadcn@latest add https://ui.bld8.dev/r/faceted-filter.json

Registry setup · Examples · API and behavior · Open the playground

COMPLETE EXAMPLES

Use it in context.

Each example includes its imports, data and state. The preview runs that same source. Include the stylesheet once in your application.

Grouped filters over table records

Whole-group selection, mixed states and readable selected summaries filter a local table.

Keyboard

  • Search narrows choices; Space toggles a row or whole group.
  • Escape closes the picker and returns focus.

States covered

  • Grouped alternatives
  • Counted options
  • Clear filters

Install this complete example and its component dependencies.

Terminal
npx shadcn@latest add https://ui.bld8.dev/r/example-facets-table.json
Complete source
React / TypeScript
/*!
MIT License

Copyright (c) 2026 Jaison

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
'use client';
import '@bld8/ui/styles.css';
import {useState} from 'react';
import {Avatar,Button,DataTable,FacetedFilter,type Column,type FacetOption} from '@bld8/ui';
type Row={id:string;title:string;status:string};
const rows:Row[]=[{id:'ISS-1',title:'Review keyboard focus',status:'review'},{id:'ISS-2',title:'Check responsive tables',status:'active'},{id:'ISS-3',title:'Document the reset path',status:'done'}];
const options:FacetOption[]=[{value:'review',label:'In review',group:'Open',count:1},{value:'active',label:'In progress',group:'Open',count:1},{value:'done',label:'Done',group:'Closed',count:1},{value:'archived',label:'Archived',group:'Closed',count:0}];
const columns:Column<Row>[]=[{key:'title',header:'Issue',cell:row=>row.title},{key:'status',header:'Status',cell:row=>options.find(option=>option.value===row.status)?.label}];
export function TableFacets(){const [selected,setSelected]=useState<string[]>([]);const visible=rows.filter(row=>!selected.length||selected.includes(row.status));return <section className="bui-stack"><FacetedFilter label="Issue status" options={options} value={selected} onValueChange={setSelected} showChips hint="Group selection includes choices hidden by search."/><DataTable caption="Filtered issues" rows={visible} columns={columns} rowKey={row=>row.id}/><p role="status">{visible.length} matching issues</p></section>;}

Resource filters that combine dimensions

Types are alternatives; an owner filter narrows the same resource list.

Keyboard

  • Tab moves between facets and removable summary buttons.
  • Space toggles choices without closing the picker.

States covered

  • OR within a facet
  • AND across facets
  • Removable summaries

Install this complete example and its component dependencies.

Terminal
npx shadcn@latest add https://ui.bld8.dev/r/example-facets-resources.json
Complete source
React / TypeScript
/*!
MIT License

Copyright (c) 2026 Jaison

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
'use client';
import '@bld8/ui/styles.css';
import {useState} from 'react';
import {Avatar,Button,DataTable,FacetedFilter,type Column,type FacetOption} from '@bld8/ui';
const resources=[{id:'brief',title:'Interface brief',type:'doc',owner:'design'},{id:'tokens',title:'Token reference',type:'code',owner:'engineering'},{id:'review',title:'Review notes',type:'doc',owner:'engineering'}];
export function ResourceFacets(){const [types,setTypes]=useState<string[]>([]),[owners,setOwners]=useState<string[]>([]);const visible=resources.filter(row=>(!types.length||types.includes(row.type))&&(!owners.length||owners.includes(row.owner)));return <section className="bui-stack"><div className="bui-form-grid"><FacetedFilter label="Resource type" options={[{value:'doc',label:'Documents',group:'Content'},{value:'code',label:'Code',group:'Content'}]} value={types} onValueChange={setTypes} showChips/><FacetedFilter label="Resource owner" options={[{value:'design',label:'Design'},{value:'engineering',label:'Engineering'}]} value={owners} onValueChange={setOwners} showChips/></div><ul aria-label="Filtered resources">{visible.map(row=><li key={row.id}>{row.title}</li>)}</ul>{!visible.length&&<p>No resources match both filters.</p>}<p role="status">{visible.length} resources</p><Button variant="ghost" onClick={()=>{setTypes([]);setOwners([]);}}>Clear resource filters</Button></section>;}

People selection by discipline

Select a discipline or individual people while submitting canonical IDs.

Keyboard

  • Arrow keys move through people and group headings.
  • Space toggles a person; reset restores the initial selection.

States covered

  • Whole discipline selection
  • Native repeated values
  • Uncontrolled reset

Install this complete example and its component dependencies.

Terminal
npx shadcn@latest add https://ui.bld8.dev/r/example-facets-people.json
Complete source
React / TypeScript
/*!
MIT License

Copyright (c) 2026 Jaison

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
'use client';
import '@bld8/ui/styles.css';
import {useState} from 'react';
import {Avatar,Button,DataTable,FacetedFilter,type Column,type FacetOption} from '@bld8/ui';
const people:FacetOption[]=[{value:'maya',label:'Maya Chen',group:'Design',description:'Product design'},{value:'sam',label:'Sam Rivera',group:'Design',description:'Research'},{value:'oliver',label:'Oliver Reed',group:'Engineering',description:'UI engineering'},{value:'lee',label:'Lee Patel',group:'Engineering',disabled:true,description:'Unavailable'}];
export function PeopleFacets(){const [message,setMessage]=useState('');return <form className="bui-stack" onSubmit={event=>{event.preventDefault();setMessage(new FormData(event.currentTarget).getAll('reviewers').join(', ')||'No reviewers');}}><FacetedFilter label="Reviewers" name="reviewers" options={people} defaultValue={['maya']} showChips/><div className="bui-between"><Button type="reset" variant="secondary">Reset reviewers</Button><Button type="submit">Use reviewers</Button></div><p role="status">{message}</p></form>;}

Quick reference

React / TypeScript
<FacetedFilter label="Status" options={options}
  value={statuses} onValueChange={setStatuses} showChips />

In the workspace or ZIP starter, import components from @bld8/ui and include @bld8/ui/styles.css once. Registry installations use your local bld8/ source path. Wrap overlays in UIProvider.

API & behaviour

Options commit stable values. Group actions select every supplied enabled option, including items hidden by search. Partial parents show mixed states. Counts are supplied descriptive values; zero does not disable an option. Unknown selected IDs are retained. Native form values repeat the name; uncontrolled reset restores initial values after a non-cancelled native reset, while controlled values remain host-owned. Read-only values are submitted and cannot change; disabled values are excluded. Compose separate facets with OR within a dimension and AND across dimensions. Applications own filtering, URL state and data access. Optional selected chips are bounded; the trigger retains all selected labels in its title.

FacetedFilter

FacetedFilter public properties
PropTypeDefault
labelRequiredstring—
optionsRequiredreadonly FacetOption[]—
classNamestring | undefined—
clearableboolean | undefined—
defaultOpenboolean | undefined—
defaultValuereadonly string[] | undefined[]
density"compact" | "comfortable" | undefined—
disabledboolean | undefined—
emptyMessagestring | undefined—
errorstring | undefined—
formstring | undefined—
hintstring | undefined—
inputRefRef<HTMLButtonElement> | undefined—
labelVisibility"hidden" | "visible" | undefined—
maxVisibleChipsnumber | undefined3
namestring | undefined—
onBlurFocusEventHandler<HTMLButtonElement> | undefined—
onOpenChange((open: boolean) => void) | undefined—
onOpenChangeComplete((open: boolean) => void) | undefined—
onValueChange((values: string[]) => void) | undefined—
openboolean | undefined—
placeholderstring | undefined—
popupDataAttributesRecord<`data-${string}`, string | number | boolean | undefined> | undefined

Non-reserved data-* metadata on the real popup, for composed editor ownership.

—
readOnlyboolean | undefined—
requiredboolean | undefined

Announces required choice; the host validates this button field when submitting.

—
searchableboolean | undefined—
showChipsboolean | undefined

Optional removable summary below the trigger. Hidden values remain selected.

false
valuereadonly string[] | undefined—

FacetOption

FacetOption public properties
PropTypeDefault
labelRequiredstring—
valueRequiredstring—
countnumber | undefined

A supplied count is descriptive; zero never silently disables a choice.

—
descriptionstring | undefined—
disabledboolean | undefined—
groupstring | undefined—
iconLucideIcon | undefined—
searchTermsreadonly string[] | undefined—

Tables come from the public TypeScript declarations. Related types and function parameters are shown alongside their component. A dash means no default is declared at the public function boundary.

Related controls

Notes to self

Test this component with real content, keyboard input and both themes. The example is a starting point; labels, error handling and behaviour still need to fit the application.