Skip to content
Suriyaprakash.
Back to Playground

SYS.03 — React QueryBuilder · Schema-driven filters+

React QueryBuilder.Find records that matter.

Combine conditions to explore employee or product data without writing a query. Try quick filters or nested AND/OR groups; results update against 300 generated records in your browser, not a live business database.
Mode
Chips + Tree
Operators
Per type
Dataset
300 seeded
Results
Live
SYS.03 / Live buildInteractive

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.

Demo schema

Loading interactive filters…

Live results

All 300 seeded records — add a filter to narrow

100% match
EmployeeRoleDepartmentStatusSalary

Nila Shah

nila.shah4201@example.com

DeveloperEngineeringActive$147,518

Ishaan Nair

ishaan.nair4202@example.com

DesignerDesignInactive$155,437

Aisha Kapoor

aisha.kapoor4203@example.com

ManagerSalesPending$163,356

Rohan Singh

rohan.singh4204@example.com

AnalystMarketingActive$171,275

Kavya Patel

kavya.patel4205@example.com

DeveloperSupportInactive$179,194

Arjun Kumar

arjun.kumar4206@example.com

DesignerEngineeringPending$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": ""
}
An application can connect 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

The schema declares the fields. QueryBuilder emits the filter contract.

Capabilities+

Features

01

Zod schema mapped to typed filter fields

02

Quick chip filters and advanced AND/OR groups

03

Type-aware operators per field

04

Live filtering over 300 seeded records

05

Live results table with match percentage

06

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.