- Accordion
- Alert
- Alert Dialog
- Aspect Ratio
- Avatar
- Badge
- Breadcrumb
- Button
- Button Group
- Calendar
- Card
- Carousel
- Chart
- Checkbox
- Collapsible
- Combobox
- Command
- Context Menu
- Data Table
- Date Picker
- Dialog
- Direction
- Drawer
- Dropdown Menu
- Empty
- Field
- Hover Card
- Input
- Input Group
- Input OTP
- Item
- Kbd
- Label
- Menubar
- Native Select
- Navigation Menu
- Pagination
- Popover
- Progress
- Radio Group
- Resizable
- Scroll Area
- Select
- Separator
- Sheet
- Sidebar
- Skeleton
- Slider
- Sonner
- Spinner
- Switch
- Table
- Tabs
- Textarea
- Toast
- Toggle
- Toggle Group
- Tooltip
- Typography
Choose the setup that matches your starting point.
Build your preset and generate an Astro project command.
Scaffold a new Astro project directly from the terminal.
Configure shadcn/ui manually in an existing Astro project.
Use shadcn/create
Build Your Preset
Open shadcn/create and build your preset visually. Choose your style, colors, fonts, icons, and more.
Open shadcn/create
Create Project
Click Create Project, choose your package manager, and copy the generated command.
The generated command will look similar to this:
pnpm dlx shadcn@latest init --preset [CODE] --template astro
The exact command will include your selected options such as --base, --monorepo, or --rtl.
Add Components
Add the Card component to your project:
pnpm dlx shadcn@latest add card
If you created a monorepo, run the command from apps/web or specify the workspace from the repo root:
pnpm dlx shadcn@latest add card -c apps/web
The command above will add the Card component to your project. You can then import it like this:
---
import Layout from "@/layouts/main.astro"
import {
Card,
CardContent,
CardDescription,
CardHeader,
CardTitle,
} from "@/components/ui/card"
---
<Layout>
<Card className="max-w-sm">
<CardHeader>
<CardTitle>Project Overview</CardTitle>
<CardDescription>
Track progress and recent activity for your Astro app.
</CardDescription>
</CardHeader>
<CardContent>
Your design system is ready. Start building your next component.
</CardContent>
</Card>
</Layout>If you created a monorepo, update apps/web/src/pages/index.astro and import from @workspace/ui/components/card instead. The monorepo layout at apps/web/src/layouts/main.astro already imports @workspace/ui/globals.css for you.
Use the CLI
Create Project
Run the init command to scaffold a new Astro project. Follow the prompts to configure your project: base, preset, monorepo, and more.
pnpm dlx shadcn@latest init -t astro
For a monorepo project, use --monorepo flag:
pnpm dlx shadcn@latest init -t astro --monorepo
Add Components
Add the Card component to your project:
pnpm dlx shadcn@latest add card
If you created a monorepo, run the command from apps/web or specify the workspace from the repo root:
pnpm dlx shadcn@latest add card -c apps/web
The command above will add the Card component to your project. You can then import it like this:
---
import Layout from "@/layouts/main.astro"
import {
Card,
CardContent,
CardDescription,
CardHeader,
CardTitle,
} from "@/components/ui/card"
---
<Layout>
<Card className="max-w-sm">
<CardHeader>
<CardTitle>Project Overview</CardTitle>
<CardDescription>
Track progress and recent activity for your Astro app.
</CardDescription>
</CardHeader>
<CardContent>
Your design system is ready. Start building your next component.
</CardContent>
</Card>
</Layout>If you created a monorepo, update apps/web/src/pages/index.astro and import from @workspace/ui/components/card instead. The monorepo layout at apps/web/src/layouts/main.astro already imports @workspace/ui/globals.css for you.
Existing Project
Create Project
If you need a new Astro project, create one first. Otherwise, skip this step.
pnpm create astro@latest astro-app -- --template with-tailwindcss --install --add react --git
This command sets up Tailwind CSS and the React integration for you. If you're adding shadcn/ui to an older or custom Astro app, make sure both are configured before continuing.
The Tailwind starter loads your global stylesheet through src/layouts/main.astro. Keep that layout in place, or make sure your page imports @/styles/global.css.
Edit tsconfig.json file
If your project already has the @/* alias configured, skip this step.
Add the following code to the tsconfig.json file to resolve paths:
{
"compilerOptions": {
// ...
"baseUrl": ".",
"paths": {
"@/*": [
"./src/*"
]
}
// ...
}
}Run the CLI
Run the shadcn init command to set up your project:
pnpm dlx shadcn@latest init
Add Components
You can now start adding components to your project.
pnpm dlx shadcn@latest add button
The command above will add the Button component to your project. You can then import it like this:
---
import Layout from "@/layouts/main.astro"
import { Button } from "@/components/ui/button"
---
<Layout>
<div class="grid h-screen place-items-center content-center">
<Button>Button</Button>
</div>
</Layout>