# Application Form: Query Builder Form

A segment builder with a match mode select, condition rows pairing field, operator, and value controls, plus a live estimate of matching contacts.

- Page: https://www.shadcn-ui-blocks.com/blocks/application-pro/forms/query-builder-form
- Collection: [Application](https://www.shadcn-ui-blocks.com/blocks/application-pro), Standard tier
- Group: [Forms](https://www.shadcn-ui-blocks.com/blocks/application-pro/forms)
- Created: 2026-07-14
- Preview image: https://www.shadcn-ui-blocks.com/blocks/application-pro/forms/query-builder-form.png

## Install

```bash
npx shadcn@latest add @shadcn-ui-blocks/application-pro-forms-query-builder-form
```

Needs an API key from a Pro or Team plan: add `@shadcn-ui-blocks` to the registries in components.json with the key as an `Authorization: Bearer` header. Setup: https://www.shadcn-ui-blocks.com/docs/shadcn-cli. The MCP server installs it without the setup: https://www.shadcn-ui-blocks.com/docs/mcp.

## Depends on

- npm packages: class-variance-authority, lucide-react, radix-ui
- shadcn/ui components: button, input, label, select
- Installs to: `@/components/blocks/application-pro/forms/query-builder-form`

## About this block

Query Builder Form defines an audience segment from stacked
conditions. A match mode select reads as a sentence, include
contacts that match all conditions below, then three
condition rows each pair a field select, an operator select,
and a value cell, one of which is a numeric input rather
than a select. An Add condition action sits underneath, and
a live estimate panel reports that 1,284 contacts currently
match.

The rows are driven by a typed conditions array, so each
field, operator, and value renders from data and the value
cell switches between a select and an input on its kind. The
layout is a four column grid on wider screens and stacks on
small ones. The estimate panel is static here; wire it to
your query so the count refreshes as conditions change.

## When to use

Reach for this block whenever people assemble a rule from
parts: audience segments, saved filters, automation
triggers, or access policies. Wire the selects and the Add
and Remove actions to state so the condition list grows, and
recompute the match estimate whenever a condition changes.

A natural flow around it on an Application Pro page:

**Before**

- [Filters and search](https://www.shadcn-ui-blocks.com/blocks/application-pro/filters-and-search)
- [Data tables](https://www.shadcn-ui-blocks.com/blocks/application-pro/data-tables)

**After**

- [Notifications](https://www.shadcn-ui-blocks.com/blocks/application-pro/notifications)
- [Workflow automation](https://www.shadcn-ui-blocks.com/blocks/application-pro/workflow-automation)

## What you can display

One strong use is the campaign audience segment. Other rule
builder surfaces:

- **Saved table filter.** Field, operator, and value rows
  that narrow a data table view.
- **Automation trigger.** Conditions that decide when a
  workflow runs, with a matching run estimate.
- **Access policy.** Attribute rows that grant a role,
  previewed against the members they would cover.

> Tip: rendering rows from a typed array is what lets Add
> and Remove edit one list instead of bespoke fields.

## More in Application Forms

- [Address Form Card](https://www.shadcn-ui-blocks.com/blocks/application-pro/forms/address-form-card)
- [API Token Create Form](https://www.shadcn-ui-blocks.com/blocks/application-pro/forms/api-token-create-form)
- [Bulk Import CSV Card](https://www.shadcn-ui-blocks.com/blocks/application-pro/forms/bulk-import-csv-card)
- [Conditional Fields Form](https://www.shadcn-ui-blocks.com/blocks/application-pro/forms/conditional-fields-form)
- [Create Project Form](https://www.shadcn-ui-blocks.com/blocks/application-pro/forms/create-project-form)
- [Cron Schedule Form](https://www.shadcn-ui-blocks.com/blocks/application-pro/forms/cron-schedule-form)
- [Danger Zone Form](https://www.shadcn-ui-blocks.com/blocks/application-pro/forms/danger-zone-form)
- [Date Range Form](https://www.shadcn-ui-blocks.com/blocks/application-pro/forms/date-range-form)
- [Feedback Form Card](https://www.shadcn-ui-blocks.com/blocks/application-pro/forms/feedback-form-card)
- [File Field Form](https://www.shadcn-ui-blocks.com/blocks/application-pro/forms/file-field-form)
- [Inline Edit Form](https://www.shadcn-ui-blocks.com/blocks/application-pro/forms/inline-edit-form)
- [Inline Validation Fields](https://www.shadcn-ui-blocks.com/blocks/application-pro/forms/inline-validation-fields)
- [Managed Fields Form](https://www.shadcn-ui-blocks.com/blocks/application-pro/forms/managed-fields-form)
- [Multi Step Form Panel](https://www.shadcn-ui-blocks.com/blocks/application-pro/forms/multi-step-form-panel)
- [Notification Matrix Form](https://www.shadcn-ui-blocks.com/blocks/application-pro/forms/notification-matrix-form)
- [Password Strength Form](https://www.shadcn-ui-blocks.com/blocks/application-pro/forms/password-strength-form)
- [Payment Details Form](https://www.shadcn-ui-blocks.com/blocks/application-pro/forms/payment-details-form)
- [Repeatable Rows Form](https://www.shadcn-ui-blocks.com/blocks/application-pro/forms/repeatable-rows-form)
- [Review and Submit Card](https://www.shadcn-ui-blocks.com/blocks/application-pro/forms/review-and-submit-card)
- [Rich Text Form](https://www.shadcn-ui-blocks.com/blocks/application-pro/forms/rich-text-form)
- [Searchable Select Blueprint](https://www.shadcn-ui-blocks.com/blocks/application-pro/forms/searchable-select-blueprint)
- [Settings Form Two Col](https://www.shadcn-ui-blocks.com/blocks/application-pro/forms/settings-form-two-col)
- [Stepper Wizard Review](https://www.shadcn-ui-blocks.com/blocks/application-pro/forms/stepper-wizard-review)
- [Tag Input Form](https://www.shadcn-ui-blocks.com/blocks/application-pro/forms/tag-input-form)
- [Threshold Slider Form](https://www.shadcn-ui-blocks.com/blocks/application-pro/forms/threshold-slider-form)
- [Unsaved Changes Form](https://www.shadcn-ui-blocks.com/blocks/application-pro/forms/unsaved-changes-form)
- [Validation States Form](https://www.shadcn-ui-blocks.com/blocks/application-pro/forms/validation-states-form)
- [View Only Form](https://www.shadcn-ui-blocks.com/blocks/application-pro/forms/view-only-form)
- [Weekly Hours Form](https://www.shadcn-ui-blocks.com/blocks/application-pro/forms/weekly-hours-form)
