sveltelean
Version v0.18.0

Two models

ConcernBits UISvelte Lean
Unit of interactionImported components (root, trigger, content)Markup on a protocol; nothing imported
State and handlersOwned by each component instanceIn the DOM; one shared listener per event type
Native elementsManaged in JavaScript, independent of native supportThe browser owns dialog, popover, details, form controls
Roles, ids, relationshipsGeneratedWritten in the markup by the author

Measured

The same UI in each library, production Vite builds, same Svelte version; library JavaScript excludes Svelte's runtime. Cases and script: benchmarks/compare.

UISvelte Lean JS (brotli)Bits UI JS (brotli)Svelte Lean charactersBits UI charactersSvelte Lean linesBits UI lines
Dialog0 B12378 B3303401816
Menu1908 B27114 B4143762213
Tabs1488 B5437 B8363395413

A thousand tabs mounted in headless Chrome, from before mount() to the second animation frame, and the heap after a forced garbage collection:

LibraryMount, medianRangeHeap, median
Svelte Lean35.1 ms33.6 ms to 36.2 ms2.3 MB
Bits UI220.8 ms209.9 ms to 233.6 ms48.9 MB

Bits UI 2.19.3, Svelte 5.57.1, Vite 7.3.6, chrome 153.0.8010.53, Apple M2, 2026-09-27. Nine fresh pages per mount case.

What the numbers do not say

  • The dialog costs Svelte Lean nothing because the browser ships it; Bits UI adds configurable focus management and scroll lock and works without invoker commands.
  • The markup is not shorter: a dialog is about equal, a menu a little longer, tabs much longer. Characters exclude whitespace; lines are counted after Prettier at 64 columns.
  • One machine, one browser, client-side mounting; no server rendering, hydration or accessibility measured.

Choosing

  • Bits UI when your team wants a typed component for every interaction, needs a widget beyond the 23 behaviors and the native primitives Svelte Lean ships, or wants one library to own the widget regardless of native browser support.
  • Svelte Lean when native primitives should work before hydration and without JavaScript, the markup should be the single representation, the listener and bundle invariants matter, and you accept writing protocol attributes and ids. Its costs are on Trade-offs.

Coexistence

Both can share an application: Svelte Lean behaviors respond only to roots marked data-slean, and native primitives have no provider. A single widget is either a component or protocol markup.