Skip to content

Installation

Add Xerobi UI to a React 19 project with Tailwind CSS v4.

Install the package

bun add @xerobi/ui

npm, pnpm and yarn work the same. Tailwind CSS v4, React 19 and Base UI are peer or direct dependencies; your package manager reports any that are missing.

Add the stylesheet

Import it after Tailwind in your global CSS. It brings the design tokens, fonts and component styles.

@import "tailwindcss";
@import "@xerobi/ui/styles.css";

Use a component

Import from the component's own path. Each path is side-effect free, so only what you import is bundled.

import { Button } from "@xerobi/ui/button"

export function Save() {
  return <Button>Save changes</Button>
}

The barrel @xerobi/ui exports everything and also tree-shakes.

Theme and brand colour

Wrap the app in ThemeProvider for light, dark and system modes, direction, and a per-product primary colour. Everything else derives from the primary.

import { ThemeProvider } from "@xerobi/ui/theme-provider"

<ThemeProvider brandColor="#1A73E8">{children}</ThemeProvider>

To avoid a flash on first paint, inline getThemeInitScript() from @xerobi/ui/lib/theme-script in the document head.

Frameworks

The library has no router or framework dependency. It is built and tested with TanStack Start, Next.js and Astro. In Next.js and Astro, interactive components need a client boundary ("use client" or a client:* directive).

React Native and Flutter

The design tokens are shared. React Native uses createNativeTheme from @xerobi/tokens/native. Flutter uses the xerobi_tokens Dart package. Component registries for both platforms are planned; the registry schema already reserves their place.

import { createNativeTheme } from "@xerobi/tokens/native"

const theme = createNativeTheme({ brand: "#1A73E8", mode: "dark" })

Search documentation

Search pages, components and blocks.