Skip to Content
vitus·labs

Why Vitus Labs

The problem the UI system solves, the principles behind it, honest numbers, and when you should pick something else.

The problem

Most React design systems end up re-solving the same four problems:

  1. Styling is tied to one CSS-in-JS engine. Components written for styled-components can't move to Emotion or a lighter engine without a rewrite.
  2. Component state turns into prop soup. size, variant, state, hover/focus/disabled, light/dark — each component hand-rolls its own conditional CSS, and every combination needs its own branch.
  3. Layout primitives get re-invented. Every project writes its own flex wrapper, grid, list renderer and overlay.
  4. Web and React Native drift apart. The native app gets a parallel component set that slowly falls out of sync.

Vitus Labs is a set of small packages that each solve one of these, designed to be used together.

Design principles

Engine-agnostic via connectors

The packages never import a CSS-in-JS library directly. They read css, styled and the theme provider from @vitus-labs/core, which you configure once with init() and a connector:

import { init } from '@vitus-labs/core'
import * as connector from '@vitus-labs/connector-styler' // or -emotion, -styled-components, -native

init({ ...connector, component: 'div', textComponent: 'span' })

The same Element, rocketstyle and coolgrid components run on styler, Emotion, styled-components or React Native. You can adopt the UI system without changing your engine, and change engines later without touching your components (see Migrating).

Multi-state styling with rocketstyle

Rocketstyle turns "a button with sizes, variants and states" into data. You declare dimensions once, attach a theme per dimension value, and consumers pick values with props (or boolean shorthands like <Button primary large />). Light/dark values are written side by side with mode(light, dark) and resolved from the provider's mode.

Composition over configuration

attrs gives every component a chainable factory (.attrs(), .config(), .statics(), .compose()), so a design system is built by extending primitives rather than wrapping them in more and more components. Elements supply the primitives: Element (a before/content/after flex layout), Text, List, Overlay and Portal.

Web and React Native from one codebase

connector-native turns the same CSS template literals into React Native style objects, and packages ship .native.ts entry points that Metro picks up automatically. Responsive values use Dimensions on native instead of @media. DOM-only pieces (Overlay, Portal, and some DOM hooks) are left out of the native builds rather than half-supported — see React Native.

One version for all packages

All UI-system packages are released together at the same version. If you use @vitus-labs/elements@2.9.0, the matching core, rocketstyle, unistyle and connectors are 2.9.0 too — no compatibility matrix.

Honest numbers

Bundle sizes of the full API, minified + gzipped, React externalized (from the styler README):

LibraryMinifiedMin + gzip
goober2.32 KB1.31 KB
@vitus-labs/styler18.94 KB6.98 KB
@emotion/react + @emotion/styled48.26 KB16.59 KB
styled-components44.93 KB17.89 KB

Styler is not the smallest option — goober is far smaller. It sits between goober and the established engines, with a styled-components-compatible API, React 19 SSR via <style precedence>, and component selectors.

Render throughput (operations per second, same machine, React 19.2.6, jsdom; reproducible with bun run bench in the styler package):

Scenariostylerstyled-componentsEmotion
SSR static (renderToString)687.9203.0323.2
SSR dynamic (function interpolation)426.2198.2306.9
SSR themed (via Provider)348.9161.7247.2
CSR mount (×100)14,33614,28114,069
CSR update (×100)13,54713,40313,388
CSR mount ×50 distinct components19,6115,78818,338

Styler leads server rendering by 2.0–3.4× over styled-components and 1.3–2.1× over Emotion. On the client it is a statistical tie for ordinary mounts and updates. React's reconciler dominates there, so don't expect a faster client from switching engines. The one client outlier is mounting many distinct styled components at once.

The UI-system packages don't bundle an engine. With connector-emotion or connector-styled-components, you pay for the engine you already have plus a small adapter (roughly 0.2–0.7 KB min+gz).

When not to use it

  • You're on React 18 or older. All packages require React 19 (styler relies on <style precedence> and ref-as-prop).
  • You want zero-runtime CSS. Everything here resolves styles at render time. If you need static extraction (vanilla-extract, Linaria, Panda, Tailwind), this is the wrong tool.
  • You want a pre-styled component library. Vitus Labs gives you primitives and styling machinery, not a ready-made Button/Modal/Table set with a look. If you need finished components today, a component library will get you there faster.
  • Your app is small and has a handful of components. Rocketstyle's dimensions and the attrs chain pay off across a design system. For a few screens, plain CSS modules or a single styled-components setup is simpler.
  • Bundle size is the only metric. goober is about 5× smaller than styler.
  • You need DOM overlays on React Native. Overlay and Portal are web-only, and some hooks aren't available on native.

Next steps

Edit on GitHub

Last updated on

On this page