Skip to main content

Installation

Install and configure shadcn/ui in your project.
You can use the CLI to automatically install and configure components. The init command will guide you through the setup process.

Quick Start

The fastest way to get started is to use the create command:
This will:
  1. Prompt you to choose a framework (Next.js, Vite, or TanStack Start)
  2. Create a new project with shadcn/ui pre-configured
  3. Install all dependencies
  4. Set up your design system

Manual Installation

If you have an existing project, you can add shadcn/ui components using the init command:
1

Run the init command

Run the shadcn init command to setup your project:
This will:
  • Detect your framework
  • Prompt you to configure components.json
  • Install dependencies
  • Set up Tailwind CSS
  • Configure import aliases
2

Configure components.json

You’ll be asked a few questions to configure your project:
This creates a components.json file in your project root:
3

Add components

You can now start adding components to your project:
The component will be added to your project in the location specified in your components.json file.

Framework-Specific Guides

We provide detailed installation guides for popular frameworks:

Next.js

Install shadcn/ui in a Next.js project (App Router or Pages Router)

Vite

Install shadcn/ui in a Vite React project

Remix

Install shadcn/ui in a Remix project

Astro

Install shadcn/ui in an Astro project

Laravel

Install shadcn/ui with Laravel and Inertia

Gatsby

Install shadcn/ui in a Gatsby project

Using Default Options

You can use the --defaults flag to skip the configuration prompts and use sensible defaults:
This will:
  • Use TypeScript
  • Use the “New York” style
  • Use “neutral” as the base color
  • Use CSS variables for theming
  • Set up standard import aliases

Installation Options

The init command supports several options:
string
The template to use (next, vite, start, next-monorepo)
string
The base color to use (neutral, gray, zinc, stone, slate)
boolean
default:"true"
Skip confirmation prompts
boolean
default:"false"
Use default configuration
boolean
default:"false"
Force overwrite of existing configuration
string
The working directory (defaults to current directory)
boolean
Use the src directory when creating a new project
boolean
default:"true"
Use CSS variables for theming
boolean
default:"false"
Enable RTL (right-to-left) support

Example Usage

What Gets Installed?

When you run init, the CLI will:
  1. Install dependencies - Installs Tailwind CSS and other required packages
  2. Create components.json - Configuration file for your project
  3. Set up globals.css - Adds CSS variables and base styles
  4. Configure tailwind.config.js - Updates Tailwind configuration
  5. Create utils file - Adds the cn() utility function
The init command will modify your tailwind.config.js and CSS files. Make sure to commit your changes before running the command.

Next Steps

After installation:
  1. Browse components to see what’s available
  2. Add your first component using the CLI
  3. Configure components.json to customize your setup
  4. Learn about theming to customize colors and styles