A nested query builder that reads like a sentence: Where, and, or, groups inside groups, drag or arrow-key rules into place, undo anything, and watch the parameterised SQL, JSON and plain English rewrite themselves as you type.
akaquery builder·rule builder·filter builder
Powered by Qnot · the rules, matching and serialisation are Qnot; this is the UI on top.
Run this in any project set up for the shadcn CLI. It copies the Rule Builder source into your components folder, so the code is yours to change.
npx shadcn@latest add https://devl.dev/r/rule-builder.jsonImport it and render it. Every prop has a typed default, so it works straight away, and you pass your own data when you’re ready.
import { RuleBuilder } from "@/components/rule-builder";
export default function Page() {
return <RuleBuilder />;
}A free React component in the Filters collection, written in TypeScript with Tailwind CSS on coss ui. MIT licensed.
Read from the Rule Builder source. Everything is optional unless it says required.
| Prop | Type | Default |
|---|---|---|
| fieldsrequired | Fields | — |
| defaultQuery | Query | emptyQuery |
| rows | readonly Record<string, unknown>[] | — |
| table | string | "accounts" |
| noun | { one: string; many: string } | { one: "account", many: "accounts" } |
| maxDepth | number | 2 |
| onChange | (query: Query) => void | — |
| className | string | — |