npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

svelte-querybuilder

v0.1.1

Published

Svelte component for complex query building

Readme

svelte-querybuilder

A Svelte 5 port of React Query Builder. Builds a nested query structure from a field/operator/value UI, backed by @react-querybuilder/core.

Install

npm i svelte-querybuilder
# OR yarn add / pnpm add / bun add

Requires Svelte 5.25 or later. @react-querybuilder/core comes along as a dependency, and the entire core API is re-exported from this package's barrel — you never need to install or import it directly.

Quick start

<script lang="ts">
  import { formatQuery, QueryBuilder, type Field, type RuleGroupType } from 'svelte-querybuilder';
  import 'svelte-querybuilder/dist/query-builder.css';

  const fields: Field[] = [
    { name: 'firstName', label: 'First name' },
    { name: 'lastName', label: 'Last name' },
    { name: 'age', label: 'Age', inputType: 'number' },
  ];

  let query = $state<RuleGroupType>({
    combinator: 'and',
    rules: [{ field: 'firstName', operator: 'beginsWith', value: 'Stev' }],
  });
</script>

<QueryBuilder {fields} bind:query />

<pre>{formatQuery(query, 'sql')}</pre>

Driving the query

Four options, in increasing order of control:

| Approach | Use when | | ------------------------- | ----------------------------------------------------------------------- | | defaultQuery | Uncontrolled — the component owns the query. | | bind:query | The common case. Two-way binding via $bindable. | | query + onQueryChange | Fully controlled, e.g. when the query lives in a store or is validated. | | manager | A QueryManager you construct and hold, driven from outside the tree. |

Undo/redo, history, and programmatic mutation all go through a QueryManager.

Styling

import 'svelte-querybuilder/dist/query-builder.css';
// ...or the structural-only stylesheet:
import 'svelte-querybuilder/dist/query-builder-layout.css';

The DOM is class-compatible with React Query Builder, so existing RQB stylesheets and themes port over unchanged. See docs/styling.md.

Docs

Examples

  • examples/demo — Vite + Svelte, running against library source. bun run --filter @svelte-querybuilder/example-demo dev
  • examples/sveltekit — SvelteKit, server-side rendering. Doubles as the repo's SSR gate (bun run test:ssr).

Non-goals

Not in v1, and not planned for the near term:

  • Drag-and-drop
  • UI-framework compatibility packages (Ant Design, Bootstrap, MUI, etc.)
  • @react-querybuilder/expr / @react-querybuilder/datetime UI integrations
  • Async option lists
  • A Redux store or a qbId registry — hold a QueryManager instance instead
  • Deprecated props carried over from React Query Builder

License

MIT