Segment builder
Build an audience from conditions joined by all or any, in nested groups, and watch its size move as you go: the estimate counts to each new figure and its share of everyone fills a bar. Alt+Enter adds a condition below the one you are in; Alt+Backspace removes it.
Estimated audience
10,524visitors
21.8% of 48.2k
Filter visitors
Showing visitors where Device is any of Mobile, and Visits ≥ 3.
In a condition, Option Enter adds one below and Option Backspace removes it.
Estimated from 1,200 recent visitors.
When to use
- Audience and cohort definitions in analytics, messaging or experiment targeting.
- Any filter whose result size decides whether it is worth saving.
When not to use
- Filtering a table in place; use the query builder on its own.
- Estimates that take seconds to compute on every keystroke; pass `estimating` and debounce on the host.
Installation
pnpm dlx shadcn@latest add @caliper/segment-builder
Adds its 42 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
SegmentBuilder
11 props
addRuleAfter
4 props
removeRule
4 props
flattenRules
4 props
Keyboard
- Enter
- Activates the focused control.
Accessibility
It exposes alert semantics, with aria-labelledby, aria-busy and aria-hidden 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/segment-builder.mdThe index of every part is at /llms.txt.