Add the query builder to your app
Define fields, manage query state, validate input, and control how users edit each query.
Read the usage guideAn open source React component for building user friendly queries and filters. Let users edit rules visually or in SQL text mode, validate input, and convert queries to SQL, MongoDB, Prisma, and other supported formats.
Configure fields and editing behavior, let users build queries visually or as text, and convert the result for your API or database.
Define fields, manage query state, validate input, and control how users edit each query.
Read the usage guideConvert query data to and from SQL, MongoDB, Prisma, Elasticsearch, OData, RSQL, and other supported formats.
View supported formatsLet users switch between the visual builder and SQL text mode while validation and protected query segments remain in place.
Explore text modeUse the default components or ready-made adapters for MUI, Ant Design, Bootstrap, Mantine, Fluent UI, and Radix Themes.
See more UI adaptersDefine the fields your users can filter, keep query data in React state, and choose when to format or send the validated filter to your API.
Read the installation guideimport { useState } from 'react';import {Builder,type DenormalizedQuery,type IBuilderFieldProps,} from '@vojtechportes/react-query-builder';import '@vojtechportes/react-query-builder/styles.css';const fields: IBuilderFieldProps[] = [{ field: 'name', label: 'Product name', type: 'TEXT' },{ field: 'price', label: 'Price', type: 'NUMBER' },];export const ProductFilter = () => {const [data, setData] = useState<DenormalizedQuery>([]);return <Builder fields={fields} data={data} onChange={setData} />;};
Follow complete recipes for tables, forms, URLs, databases, and server-side filtering.