Introduction
Cubix is a set of accessible, token-driven React components and the system that distributes them. Three primitive bases, one visual API, and source you own. Open source. Open code.
Cubix is not a component library you install. It is the foundation you build your own component library on.
Most UI kits follow the same pattern: install a package, import its components, and use them as-is. That works until the product needs something the package did not plan for - a different interaction model, a layout the API cannot express, or a control that is simply missing.
From there, teams wrap components, override styles with ever more specific selectors, or mix libraries with incompatible APIs. The UI layer slowly becomes the part of the codebase nobody wants to touch.
Cubix is built to avoid that. 55 production-ready components today, each available on three accessibility backends, all shaped by a few principles:
Open code
Every component is TypeScript source in your repo. Read it, change it, or delete it.
One API, three bases
Base UI, React Aria, or Radix UI underneath. The same props, slots, and styles on top.
Design tokens
Nine semantic tokens drive color, radius, and dark mode across the whole system.
Agent interfaces
Dedicated surfaces for chat and agent products, built on the same ownership model.
Typeset
Owned typesetting presets for docs, articles, and streaming chat output.
RTL and locale
Logical properties, bidirectional layouts, and a tuned Persian type stack.
Distribution
A flat-file registry schema and a CLI that installs exactly what you ask for.
AI-ready
Predictable source, project context, Skills, and MCP so assistants write correct Cubix code.
Open code
The CLI copies real TypeScript files into components/cubix. Nothing is compiled away or hidden behind a package boundary, which means:
- Full transparency - markup, variants, ARIA wiring, and
data-slotstructure are all visible. - Direct customization - to change how a button behaves, edit
components/cubix/button.tsx. No wrapper, no style overrides. - No upstream lock-in - a one-line fix never waits on someone else's release.
How do I pick up upstream updates?
cubix-ui view <name> to inspect the latest registry version, compare it with your local file, and merge what you want. cubix-ui add never replaces an existing file unless you pass --overwrite, so your edits stay safe.One API, three bases
Teams standardize on different accessibility primitives for good reasons. Cubix treats all three as first-class: every component ships for each base with identical props, variants, tokens, and slot names, so screens do not change when the primitive underneath does.
| Base | Flag | Choose it when |
|---|---|---|
| Base UI | base (default) | Starting a new project and want the default Cubix stack. |
| React Aria | --base aria | Your team already relies on React Aria hooks and behaviors. |
| Radix UI | --base radix | Your app is built on Radix primitives and you want to keep them. |
Set the default in cubix.json, or override it for a single install:
pnpm dlx cubix-ui@latest add dialog --base ariaEvery component page includes a base switcher, so you can compare the source for each backend side by side.
Design tokens
Components never reach for a hardcoded color. They speak a small set of semantic tokens, defined as oklch values for light and dark mode in globals.css:
background
Page surface
foreground
Primary text
muted
Subtle surfaces
accent
Hover and selection
primary
Brand actions
destructive
Errors and danger
border
Dividers and outlines
input
Form control borders
ring
Focus indicators
Restyle the entire product by editing variables, and open component files only when structure or behavior must change. The full map lives in Theming.
Agent interfaces
Chat and agent products need more than forms and dialogs. Cubix is building a dedicated set of agent surfaces that handle the hard states - streaming, partial output, tool failures, and long transcripts - not just the happy path:
Conversation
In progressTop-level chat shell that sticks to the latest turn, with empty, scroll, streaming, and download controls.
Message Scroller
In progressChat transcript scroller for turn anchoring, streaming follow, history restore, and jump controls.
Prompt Input
In progressAI prompt composer with actions, file attachments, and submit controls.
Streaming Text
In progressProgressive text surface for token-by-token model output during a stream.
Thinking
In progressCollapsible block for model reasoning and chain-of-thought while a reply is prepared.
Tool Call
In progressVisualize tool and function invocations with status, args, and results.
Sources
In progressCitation list for retrieved documents and grounded answer references.
Branch
Navigate alternate reply branches when regenerating or editing a turn.
Each surface follows the same rules as every other Cubix component: owned source, three bases, semantic tokens. Track progress on the Changelog.
Typeset
Markdown, CMS content, and model output arrive as unstyled HTML. Typeset gives them one shared rhythm: semantic type roles, a reading measure, and presets driven by three controls - size, leading, and flow.
Spacing runs in one direction, so a streaming reply can append new blocks without reflowing the ones above it. The presets are plain CSS in your project - this page uses the docs-prose preset. Read more in Typeset.
RTL and locale
Bidirectional layout is part of the system, not a patch on top of it. Components use logical properties (ps-*, me-*, start, end), so they mirror correctly under dir="rtl" without extra classes.
Persian content under [lang=fa] uses IRANSans XV with baseline-corrected metrics and tuned leading, while type sizes stay identical to the documented scale across locales.
Distribution
Cubix is also a code distribution system, made of two parts:
- Registry schema - a flat-file JSON format that lists each item's files, dependencies, and base variants.
- CLI -
init,add,view,search,build, andinfofor installing, inspecting, and publishing items.
Use the same schema to publish your own components to other projects. See CLI and Registry.
AI-ready
Open source and a consistent API make Cubix easy for assistants to read and extend. Cubix goes further by giving them project context: cubix.json and cubix-ui info expose your framework, aliases, base, and installed components.
Install the Cubix Skills and connect MCP so the assistant uses the right imports, the right base, theme tokens, and live registry tools - on the first try.
Quick start
Initialize Cubix in the root of your app. This writes the design tokens, creates lib/utils.ts, and adds cubix.json:
pnpm dlx cubix-ui@latest initThen add your first component:
pnpm dlx cubix-ui@latest add buttonThe full walkthrough, including manual setup, is in Installation.
Framework support
Cubix is React source plus Tailwind CSS, not a closed runtime. It runs anywhere you can render React.
- First-class
Next.js
Full App Router and React Server Components support. Cubix is developed and tested against Next.js - this docs site is a Next.js app.
- Supported
Vite
Add the tokens to your CSS entry, set up the @/* path alias, and paste the components. Works with Vite 5+ out of the box.
- Supported
TanStack Start
SSR-compatible React components that work with TanStack Start's router and server functions.
- Supported
Laravel
Use Cubix in a Laravel app with a React frontend (Inertia). Paste components into your React tree and theme them with the same tokens.
- Supported
React Router
Client-compatible React sources that drop into React Router (and Remix) apps as-is, including streaming.
- Supported
Astro
Use Cubix inside Astro islands with @astrojs/react. Interactive components ship the 'use client' directive React needs.
- Supported
Manual
Any other React 18+ host with Tailwind CSS v4. Wire the path alias, dependencies, utilities, and tokens by hand, then paste components.
Requirements: React 18+ (React 19 recommended), Tailwind CSS v4, and TypeScript.