The MUI builder that shadcn add installs, live on this page. Edit a rule and watch the exports.
Install it
One command copies the MUI builder and the kit-agnostic core it shares with the other kits into components/qnot, and installs @qnot/core and @qnot/react. MIT licensed.
pnpm dlx shadcn@latest add https://coss.com/qnot/r/query-builder-mui.jsonInstalls @mui/material, @mui/icons-material and Emotion. The builder wraps itself in its own ThemeProvider (light or dark from the dark class on <html>), so it needs neither your theme nor CssBaseline; edit themeFor in the file to match your app.
Source
4 files, exactly what installsUse it.
Pickers are MUI Selects and Autocompletes, values are TextFields, AND / OR is a ToggleButtonGroup, and the add menu is a Menu. All of it sits on @qnot/react's hooks, which own the state.
Read the query with the store's onChange, useQuery() or store.getQuery(), and encode it with any format.
What you get.
- Source you ownshadcn add
The builder lands in components/qnot as plain TSX. Change any control; nothing is hidden in a package.
- Typed schemadefineFields
Fields declare their editors: text, number, enum, multi-select, dates, booleans, lists and objects.
- Export anywhereSQL · Mongo · JsonLogic
The store holds plain JSON. Encode it to parameterized SQL, MongoDB, JsonLogic, Elasticsearch or SpEL.
- Undo, drag and drophistory · dnd
Every edit is a step. Drag rules and groups by the handle; locks and limits are respected.
Questions people ask
- Is it free? Does it need MUI X?
- Yes, and no. The builder is MIT licensed and uses only @mui/material and @mui/icons-material (both MIT) with Emotion. No MUI X package or license is involved.
- Do I need to use shadcn to install it?
- Only the CLI, once: shadcn add copies the file into your project and installs the npm packages. It needs a components.json, which shadcn init creates; you do not have to use any shadcn/ui components afterwards.Install with shadcn
- Does it follow my MUI theme?
- It wraps itself in its own ThemeProvider and picks light or dark from the dark class on <html>, so it works without your theme or CssBaseline. To match your app, edit themeFor in the installed file, or remove the wrapper and let it inherit your theme.
- Which MUI version is it built for?
- This site runs it on @mui/material 9.5. It imports components by path (@mui/material/Autocomplete and so on), which keeps the bundle to what it uses.
- Does it work with the Next.js App Router?
- Yes. The builder is a client component. If you use MUI elsewhere on the page, keep your usual AppRouterCacheProvider from @mui/material-nextjs so Emotion's styles are collected on the server.
- How do I get SQL or a MongoDB filter out of it?
- The store holds the query as plain JSON. Encode it with a codec from @qnot/core/formats: sqlFormat({ dialect: "postgres", params: "numbered" }) gives SQL with bound parameters; mongo and jsonlogic give filters.Formats