Facets
v0.64.0, changelogThe facet column beside a catalog or table: checkbox groups with counts and "Show all N", pinned under the shell's bar; FacetsDrawer opens the same list in a bottom sheet on phones.
8 of 24 recordings
- Recording 01Camera · Taipei HQ
- Recording 04LiDAR · Taipei HQ
- Recording 07Depth camera · Taipei HQ
- Recording 10IMU · Taipei HQ
- Recording 13Thermal · Taipei HQ
- Recording 16Radar · Taipei HQ
- Recording 19Microphone · Taipei HQ
- Recording 22Camera · Taipei HQ
Beside list
npx shadcn add @syncrobotic/facets Also installs: lucide-react@^1, @syncrobotic/cn, @syncrobotic/badge, @syncrobotic/button, @syncrobotic/checkbox, @syncrobotic/choice-field, @syncrobotic/sheet, @syncrobotic/format-number
Overview
When to use
- A catalog of datasets, recordings or robots narrowed by a few fixed facets: tier, task, site, sensor.
- A search results page with counts per facet value.
- The same facets on phones, from a Filters button in the toolbar (
FacetsDrawer; thesheet-filterspattern is a whole example).
Use something else
- One facet as a row of chips above a list: Chip group.
- Filters that must live in the URL and work before JavaScript: Filter form.
- A query of any field and operator: Filters.
More examples
States and real uses. Each example is also a Storybook story and a visual regression test.
Show all
On phones
Zh tw
Patterns
Ready-made uses of facets with real data and copy. Each installs as source under its own name.
Filters on a phone
The facets of a list in a bottom sheet from the toolbar's Filters button, the list and its count behind it.
- FacetsDrawer, never a hand-made sheet of checkboxes. Picks apply at once; Done closes the sheet and Clear all empties it.
- Each option says how many rows it leaves; beside the list, how many are left of how many, in a polite live region.
- Nothing left: an inline EmptyState with Clear filters.
Filters sheet
Filters on a phone with FacetsDrawer: the facets in a bottom sheet from the toolbar, each option with how many it leaves, the list and its count behind it.
Usage rules
- A few questions (tier, task, site), any of whose options can be on. Options in one facet combine with OR, facets with AND; the page filters, the facets only hold the picks.
- Give every option its
count, how many rows have it, computed by the page or the query. Passlocaleso counts are grouped as on the server. Facetsis the column from 1024 px; putFacetsDrawerin the toolbar for smaller screens and give both the samevalueandonValueChange. Never a second, hand-made sheet of checkboxes.- The column pins under the shell's bar (
--shell-top) and scrolls on its own when it is taller than the space under it, so the list beside it scrolls without taking the filters away. maxfolds a long facet after that many options with "Show all N"; picked options always stay in view. A facet's ownmaxwins.- Picks apply at once, in the column and in the drawer; the drawer's Done only closes it. Say what they leave ("12 of 40 recordings") beside the list, in a polite live region.
- A drawer opened from its button moves focus into the sheet. One that opens on load (
defaultOpen, a preview) passesonOpenAutoFocus={(e)so the page keeps its focus.=> e.preventDefault()} - A query people build from any field and operator is
filters; one facet as a row of chips above a list ischip-group.
Changelog
- 0.64.02026-12-01Formatted with Prettier (class order sorted); the code is unchanged.
- 0.58.02026-11-28Stable: shipped ten releases with no breaking change, with unit tests, measured accessibility (components) and use/instead docs. Its API now changes only after a release deprecates what goes, with a migration line.
- 0.53.02026-11-27Its doc opens with its description, word for word; the code is unchanged.