Requirements
- Astro 7 or later
- Tailwind CSS v4
Start fresh
Create a new Astro project with Bearnie pre-configured:
npm create bearnie my-appnpm create bearnie my-app
npm create bearnie my-app
bun create bearnie my-appbun create bearnie my-app
bun create bearnie my-app
pnpm create bearnie my-apppnpm create bearnie my-app
pnpm create bearnie my-app
yarn create bearnie my-appyarn create bearnie my-app
yarn create bearnie my-app
The scaffolder asks for a base color (grays) and an accent color (primary) — see themes in the CLI docs for the full list. Skip the prompts with a flag, e.g. --theme=slate-blue.
Then navigate to your project and start developing:
cd my-app
npm install
npm run dev
Every scaffold includes a bearnie.json config at the project root, so the CLI works without running bearnie init first.
Full install
Want all components included from the start? Use the --full flag:
npx create-bearnie my-app --full
This fetches all components from the registry, installs them in src/components/bearnie/, and adds a barrel export at src/components/bearnie/index.ts. Great for exploring or prototyping.
Add to existing project
Run the init command to configure your existing Astro project:
pnpm dlx bearnie add stylespnpm dlx bearnie add styles
pnpm dlx bearnie add styles
yarn dlx bearnie add stylesyarn dlx bearnie add styles
yarn dlx bearnie add styles
Import the styles in your main CSS file:
@import "tailwindcss";
@import "./bearnie.css";
npx bearnie add button card dialognpx bearnie add button card dialog
npx bearnie add button card dialog
bunx bearnie add button card dialogbunx bearnie add button card dialog
bunx bearnie add button card dialog
pnpm dlx bearnie add button card dialogpnpm dlx bearnie add button card dialog
pnpm dlx bearnie add button card dialog
yarn dlx bearnie add button card dialogyarn dlx bearnie add button card dialog
yarn dlx bearnie add button card dialog
When you add interactive components, Bearnie installs shared runtime helpers under src/utils/runtime/ automatically. No manual runtime wiring is needed.
Barrel imports
After adding components, install the barrel export for named imports from a single path:
pnpm dlx bearnie add barrelpnpm dlx bearnie add barrel
pnpm dlx bearnie add barrel
yarn dlx bearnie add barrelyarn dlx bearnie add barrel
yarn dlx bearnie add barrel
---
import { Button, Card, CardHeader, CardTitle } from "@/components/bearnie";
---
<Card>
<CardHeader>
<CardTitle>Welcome</CardTitle>
</CardHeader>
<Button>Get started</Button>
</Card>
Run bearnie add barrel after your components are installed. The --full scaffold includes the barrel automatically.
Manual setup
1. Add the cn utility
Create src/utils/cn.ts:
export function cn(...classes: (string | undefined | null | false)[]): string {
return classes.filter(Boolean).join(' ');
}
Add to your tsconfig.json:
{
"compilerOptions": {
"baseUrl": ".",
"paths": {
"@/*": ["src/*"]
}
}
}
3. Add theme styles
Add the styles via CLI:
pnpm dlx bearnie add stylespnpm dlx bearnie add styles
pnpm dlx bearnie add styles
yarn dlx bearnie add stylesyarn dlx bearnie add styles
yarn dlx bearnie add styles
Then import in your main CSS file:
@import "tailwindcss";
@import "./bearnie.css";
4. Add components
Use the CLI or copy components from src/components/bearnie/ to your project.
npx bearnie add button cardnpx bearnie add button card
npx bearnie add button card
bunx bearnie add button cardbunx bearnie add button card
bunx bearnie add button card
pnpm dlx bearnie add button cardpnpm dlx bearnie add button card
pnpm dlx bearnie add button card
yarn dlx bearnie add button cardyarn dlx bearnie add button card
yarn dlx bearnie add button card
src/
├── components/
│ └── bearnie/
│ ├── index.ts
│ ├── button/
│ │ └── Button.astro
│ └── card/
│ ├── Card.astro
│ ├── CardHeader.astro
│ └── CardContent.astro
├── styles/
│ └── bearnie.css
└── utils/
└── cn.ts
Interactive components (dialog, popover, tabs, …) also install just the
runtime modules they need under src/utils/runtime/.
Updating components
Components and styles are copied to your project. You own them. They don’t auto-update when Bearnie releases changes.
See what changed between your files and the registry:
Then pull the latest versions when you’re ready:
update shows what will change and asks before writing — if you’ve customized a component, review the diff first and merge manually where needed.
This is intentional. You control when updates happen and what gets changed.