Skip to content

Documentation

Installation

Use the release-candidate archive and its compiled stylesheet in Next, TanStack Start, or React + Vite.

idle

Install the release candidate

The 0.1.0 release candidate is not yet published on npm. Pack it from the repository, then install the archive in an existing React app. Workspace apps can use workspace:* instead.

React and ReactDOM must satisfy ^19.2.8. Import @mizen-labs/ui/styles.css once at the application root. It contains the compiled atomic styles; components load their own structural CSS. No consumer Babel or PostCSS setup is required.

Next

Transpile the package: its components import their own CSS files. Then render ThemeScript and ThemeProvider in the root layout.

next.config.mjs

Global stylesheet

Import @mizen-labs/ui/styles.css before your app stylesheet in the root layout. The theming guide shows the complete Next layout; the root route below shows TanStack Start.

Your app owns its document defaults. Set your interface font on body; Mizen controls inherit it.

app/globals.css

React + Vite

The default create-vite React template works without special Vite configuration. Import Mizen CSS in src/main.tsx or src/main.jsx, call initializeTheme before createRoot, and wrap the mounted tree in ThemeProvider. Keep existing StrictMode, application providers, and CSS.

JavaScript omits the TypeScript non-null assertion after getElementById. Initialization applies the saved or system theme before the first app frame. Custom initialization and provider options must match. This client-only setup needs no SSR ThemeScript or ssr.noExternal setting. Init and doctor support conventional index.html module entries.

src/main.tsx

TanStack Start: Vite

TanStack Start builds with Vite. The package ships its atomic CSS, so no StyleX compiler plugin is needed in the consumer.

Keep @mizen-labs/ui out of the server's externals. Its components import their own CSS files, which Node cannot load directly.

vite.config.js

TanStack Start: root route

Render ThemeScript in the head, before HeadContent, so the theme applies before first paint. Load the package stylesheet and font through the route's head links, and wrap the content in ThemeProvider.

A packed-archive test builds this setup and checks server rendering, hydration, the theme bootstrap, extracted styles, and keyboard interaction, alongside the Next consumer.

src/routes/__root.jsx

Tested versions

Tested together: React 19.3, StyleX 0.19.1, Next 16.3, and TanStack Start 1.169 with Vite 8. A packed-archive test installs Mizen into a fresh app for each framework and checks server rendering, hydration, the theme bootstrap, extracted styles, and keyboard interaction.

Mizen is pre-1.0: minor versions can change the API.