SYS.03 — React QueryBuilder · Schema-driven filters+
React QueryBuilder.Find records that matter.
- Mode
- Chips + Tree
- Operators
- Per type
- Dataset
- 300 seeded
- Results
- Live
Try itStart with quick filter chips for simple cases, or switch to Advanced to nest AND/OR groups. Results and the filter payload update live.
Loading interactive filters…
Live results
All 300 seeded records — add a filter to narrow
| Employee | Role | Department | Status | Salary |
|---|---|---|---|---|
Nila Shah nila.shah4201@example.com | Developer | Engineering | Active | $147,518 |
Ishaan Nair ishaan.nair4202@example.com | Designer | Design | Inactive | $155,437 |
Aisha Kapoor aisha.kapoor4203@example.com | Manager | Sales | Pending | $163,356 |
Rohan Singh rohan.singh4204@example.com | Analyst | Marketing | Active | $171,275 |
Kavya Patel kavya.patel4205@example.com | Developer | Support | Inactive | $179,194 |
Arjun Kumar arjun.kumar4206@example.com | Designer | Engineering | Pending | $187,113 |
Showing 6 of 300 matches · evaluated live on every edit · payload below is what you’d send as queryParams.filters
Filter payload
no filters{
"logic": "AND",
"conditions": [],
"search": ""
}fetchData to an API that validates and translates this filter payload. This demo evaluates filters locally; it is not connected to the separate DataTable demo.Quick filters: one labelled control per field, with active filters listed above as removable chips. Good for simple, everyday searches.
Advanced: AND/OR rail per group, add condition or inner group (max depth 2). Field change resets the operator.
Live engine: every operator from the schema runs client-side against seeded rows — deterministic between server and browser.
What+
What is a schema-driven QueryBuilder?
A schema-driven QueryBuilder is a visual filter composer whose fields, input types, and operators are derived from a Zod schema instead of being hand-written per screen. The schema is the single source of truth: add a field to the schema and the builder picks it up with the right input control and operator set — no filter UI code to maintain.
This playground is a working demonstration of that pattern. Both demo schemas (employee and product) are plain Zod objects with field metadata; the builder turns them into typed filter fields, and a small evaluation engine runs the resulting query against seeded records in real time.
How it works
zodToFilterFields maps each schema key to a FilterField — type, label, and allowed operators. Quick mode renders one chip per field with a fixed operator; advanced mode renders a tree of conditions and nested AND/OR groups (max depth 2). Every edit emits a JSON payload shaped like { logic, conditions, search } — a payload an application can pass through queryParams.filters.
The payload feeds a pure evaluation engine (evaluateFilters.ts) that implements every operator — text contains, number comparisons, boolean flags, multiselect includes, date before/after/between — and recurses through groups. The 300 demo rows are generated with per-row deterministic seeds, so server and browser evaluate against identical data.
Integration+
Usage
Capabilities+
Features
Zod schema mapped to typed filter fields
Quick chip filters and advanced AND/OR groups
Type-aware operators per field
Live filtering over 300 seeded records
Live results table with match percentage
JSON payload preview matching the DataTable contract
When to use a component like this
A QueryBuilder earns its place when users need to compose their own filters — admin panels, ERP list screens, CRM segments, support queues, audit logs. Deriving the builder from a schema keeps field definitions reusable. A backend integration still needs to validate allowed fields and operators, enforce permissions and translate the payload into database queries.
Built with React, TypeScript and Zod. Related demos: the React DataTable playground, which demonstrates the record-management interface, and the SchemaForm builder, which uses the same schema-driven pattern for data entry.
See them in real applications.
The same DataTable, form and query patterns power the admin workspaces in IndianContext and VetNest. Read how they fit into full applications, or get in touch about a role or project.