Query builder
Build a filter from conditions and nested groups, typed by field: text, number, date, options and yes/no. It reads back as a sentence, counts matches live, flags unfinished conditions and saves segments.
Filter accounts
Showing accounts where Plan is any of Team or Business, and MRR ≥ 1000, and (Region is any of EMEA, or Seats between 20 and 60).
6 accountsWhen to use
- Segments, audiences and saved filters.
- Admin search over many fields.
When not to use
- Two or three filters; use filter chips.
Installation
pnpm dlx shadcn@latest add @caliper/query-builder
Adds its 7 files to components/ui/, each with its own stylesheet, and installs their packages. Pro installs with your access token, set up once per project. See Pro access. The first part also adds Caliper UI’s tokens; import them once as in Installation.
API reference
emptyQuery
0 props
No props of its own; it re-exports a primitive and takes that primitive’s props.
ruleComplete
5 props
matchQuery
4 props
describeQuery
4 props
QueryBuilder
9 props
Keyboard
- Keyboard and focus come from Radix popover: arrow keys move through items, Enter and Space select, and Escape closes and returns focus.
Accessibility
It exposes group semantics, with aria-labelledby, aria-label, aria-hidden, aria-pressed and aria-live kept in step with state. Changes that matter are announced through a live region.
Notes for AI
Give your coding assistant this page as Markdown instead of screenshots: the props, keyboard and examples in one file.
/docs/components/query-builder.mdThe index of every part is at /llms.txt.