Skip to content
caliper ui pro docs

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.

Pro

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 accounts
Conditions
Match
of these
  • Group, level 2
    Match
    of these
    • and

When to use

  • Segments, audiences and saved filters.
  • Admin search over many fields.

When not to use

  • Two or three filters; use filter chips.

Installation

terminal
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
PropTypeDefault
kind *"rule"—
id *string—
field *string—
operator *string—
valueQueryValue—

matchQuery

4 props
PropTypeDefault
kind *"group"—
id *string—
combinator *"and" | "or"—
children *readonly (QueryGroup | QueryRule)[]—

describeQuery

4 props
PropTypeDefault
kind *"group"—
id *string—
combinator *"and" | "or"—
children *readonly (QueryGroup | QueryRule)[]—

QueryBuilder

9 props
PropTypeDefaultDescription
fields *readonly QueryField[]—
value *QueryGroup—
onChange *(query: QueryGroup) => void—
count((query: QueryGroup) => number)—How many records match, for the live preview.
nounstring"records"What the records are, plural, e.g. "customers".
maxDepthnumber3
segmentsreadonly QuerySegment[][]
onSegmentsChange((segments: QuerySegment[]) => void)—
classNamestring—

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.md

The index of every part is at /llms.txt.

More in Dense data