Skip to content

Get started

bambiui is a CLI-first, source-distributed UI toolkit. The CLI copies framework-specific component files and design tokens directly into your project, so your app owns the source it runs.

  • Node.js 22.12.0+
  • A project using React, Svelte, Vue, or Astro

Run the CLI package from your project root. It exposes the bambiui executable, auto-detects your framework, creates bambiui.config.json, and writes the global design token file.

Terminal window
npx bambiui init

What it creates:

FilePurpose
bambiui.config.jsonStores your framework, component directory, and token file path
src/styles/bambi.cssGlobal design tokens as CSS custom properties

You can skip the interactive prompts with --yes to accept detected defaults:

Terminal window
npx bambiui init --yes

Or override specific values:

Terminal window
npx bambiui init --framework react --component-dir src/ui --tokens-file src/styles/tokens.css

Import bambi.css once in your app’s global stylesheet or entry point. All component CSS depends on these tokens being present.

// src/main.tsx or src/App.tsx
import './styles/bambi.css';

Add the Button component to your project:

Terminal window
npx bambiui add button

The CLI installs the following self-contained files into your component directory (default: src/components/ui/button/):

FilePurpose
Button.astro / button.tsx / Button.svelte / Button.vueComponent source
recipe.tsStyle recipe — maps props to CSS data attributes
types.tsShared TypeScript types
button.cssComponent CSS and component-local token defaults
index.tsRe-exports Button, recipe helpers, defaults, and types

The installed files do not import @bambiui/components, @bambiui/core, or @bambiui/tokens at runtime.

import { Button } from './components/ui/button';
export default function App() {
return (
<Button intent="primary" size="md">
Get started
</Button>
);
}

Re-run add with --force to overwrite existing files with the latest source:

Terminal window
npx bambiui add button --force

The config file is created by init and read by every subsequent add command. You can edit it manually.

{
"framework": "react",
"componentDir": "src/components/ui",
"tokensFile": "src/styles/bambi.css"
}
FieldDescriptionDefault
frameworkreact, svelte, vue, or astroAuto-detected
componentDirDirectory where components are installedsrc/components/ui
tokensFilePath for the global token CSS filesrc/styles/bambi.css
bambiui init
bambiui add <component>
Options:
--framework react|svelte|vue|astro Override framework
--component-dir <path> Override component directory
--tokens-file <path> Override token file path
--registry-url <url> Use a custom registry (default: https://bambiui.com)
--cwd <path> Run in a different directory
--force Overwrite existing files
--yes, -y Accept defaults without prompting

bambiui supports both [data-theme='dark'] and the .dark class on <html> for dark mode. Toggle both when you want the same behavior as the docs and builder:

document.documentElement.setAttribute("data-theme", "dark");
document.documentElement.classList.add("dark");

Tokens for both modes are included in bambi.css. Light semantic values are in :root, dark semantic overrides are in [data-theme='dark'], .dark. Color scales such as --bambi-primary-50 through --bambi-primary-950 stay global; dark mode changes semantic aliases like --bambi-primary, not the scale itself.