Skip to content

Get Started

BambiUI is a source-first component library. The CLI copies component files and design tokens directly into your project — no runtime package, no version lock-in.

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

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

Terminal window
npx @bambiui/cli 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/cli init --yes

Or override specific values:

Terminal window
npx @bambiui/cli 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/cli add button

The CLI installs the following 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-scoped CSS (imported by the component)
index.tsRe-exports Button and all types
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/cli 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: GitHub raw)
--cwd <path> Run in a different directory
--force Overwrite existing files
--yes, -y Accept defaults without prompting

BambiUI uses the .dark class on <html> for dark mode. Toggle it based on user preference:

document.documentElement.classList.toggle('dark');

Tokens for both modes are included in bambi.css. Light values are in :root, dark overrides in [data-theme='dark'], .dark.