shadcn
Add and manage shadcn/ui components via CLI. Use when installing new UI components, building forms with validation, creating modals/dialogs/sheets, adding navigation menus, setting up data tables or charts, or updating existing shadcn components.
When & Why to Use This Skill
The shadcn/ui CLI skill streamlines the process of adding and managing accessible, customizable React components. Built on Radix UI and Tailwind CSS, it enables developers to instantly integrate complex UI elements—ranging from forms and data tables to navigation menus—directly into their codebase. This tool eliminates manual boilerplate, ensures design consistency, and provides full control over component source code for seamless customization, making it an essential asset for modern frontend development.
Use Cases
- Rapidly scaffold professional web interfaces by installing pre-built, accessible components like cards, tabs, and accordions.
- Build robust, accessible forms with built-in validation using the integrated form, input, and select component groups.
- Enhance user experience with interactive feedback elements such as modals, dialogs, toasts, and tooltips without writing complex logic from scratch.
- Create sophisticated data-driven layouts using the data-table and chart components for high-performance analytics dashboards.
- Maintain a clean and scalable project structure by managing UI component updates and custom installation paths via simple CLI commands.
| name | shadcn |
|---|---|
| description | Add and manage shadcn/ui components via CLI. Use when installing new UI components, building forms with validation, creating modals/dialogs/sheets, adding navigation menus, setting up data tables or charts, or updating existing shadcn components. |
shadcn/ui CLI
Quickly add pre-built, customizable React components based on Radix UI and Tailwind CSS.
Quick Reference
| Command | Purpose |
|---|---|
npx shadcn@latest add <component> |
Add single component |
npx shadcn@latest add btn dialog |
Add multiple components at once |
npx shadcn@latest add -a |
Add ALL components |
npx shadcn@latest add -o <component> |
Overwrite existing component |
npx shadcn@latest view <component> |
Preview component before install |
npx shadcn@latest init |
Initialize project (first-time) |
Common Component Groups
Forms: button, input, label, select, checkbox, radio-group, switch, textarea, form
Layout: card, separator, tabs, accordion, collapsible, resizable
Feedback: alert, alert-dialog, dialog, drawer, sheet, toast, sonner, tooltip, popover
Navigation: dropdown-menu, menubar, navigation-menu, breadcrumb, pagination, command
Data Display: table, data-table, avatar, badge, calendar, carousel, chart
Usage Patterns
Add a single component
npx shadcn@latest add button
Add multiple related components
npx shadcn@latest add form input label select
Skip confirmation prompts
npx shadcn@latest add -y dialog
Overwrite existing component (after shadcn update)
npx shadcn@latest add -o button
Preview before installing
npx shadcn@latest view chart
Custom install path
npx shadcn@latest add button -p src/components/ui
Key Flags
| Flag | Short | Description |
|---|---|---|
--yes |
-y |
Skip confirmation prompt |
--overwrite |
-o |
Overwrite existing files |
--all |
-a |
Install all components |
--path <path> |
-p |
Custom destination path |
--silent |
-s |
Suppress output |
Project Notes
- Components install to
src/ui/in this project (configured incomponents.json) - Uses
@/path alias for imports - Tailwind CSS + CVA (class-variance-authority) for variants
- All components are fully customizable after installation
Troubleshooting
Component already exists: Use -o flag to overwrite
npx shadcn@latest add -o button
Missing dependencies: The CLI auto-installs peer deps, but if issues occur:
npm install @radix-ui/react-<primitive> class-variance-authority
Path issues: Check components.json for configured paths