CLI Quickstart

Command Line Interface (CLI) to manage and configure your project efficiently.

Initialize CLI

Use the init command to initialize configuration and dependencies for a new project.

npx shadcn@latest init

This installs dependencies, sets up the cn utility, configures tailwind.config.js, and generates a components.json file.

You will be asked a few questions to configure components.json:

Which style would you like to use? New York
Which color would you like to use as base color? Zinc
Do you want to use CSS variables for colors? no / yes

Options for init

Usage: shadcn init [options] [components...]
 
initialize your project and install dependencies
 
Arguments:
  components         the components to add or a url to the component.
 
Options:
  -d, --defaults    use default values i.e new-york, zinc and css variables. (default: false)
  -f, --force       force overwrite of existing components.json. (default: false)
  -y, --yes         skip confirmation prompt. (default: false)
  -c, --cwd <cwd>   the working directory. defaults to the current directory.
  -h, --help       display help for command
 

Add Components

Use the add command to add new components and their dependencies:

npx shadcn@latest add [component]

Options for add

Usage: shadcn add [options] [components...]
 
add a component to your project
 
Arguments:
  components         the components to add or a url to the component.
 
Options:
  -y, --yes          skip confirmation prompt. (default: false)
  -o, --overwrite    overwrite existing files. (default: false)
  -c, --cwd <cwd>    the working directory. defaults to the current directory.
  -p, --path <path>  the path to add the component to.
  -h, --help         display help for command

Use in Monorepo

To specify a workspace path in a monorepo, use -c or --cwd:

npx shadcn@latest init -c ./apps/www

or

npx shadcn@latest add alert-dialog -c ./apps/www

Installation through CLI

You can install ScrollX UI components through the CLI. Use the following command structure:

npx shadcn@latest add https://scrollx-ui.vercel.app/registry/[component].json

Integrates a new component into your project.

npx shadcn@latest add https://scrollx-ui.vercel.app/registry/alert-dialog.json

Built withby Ahdeetai.