CLI
We rely on shadcn CLI to add components and blocks to your project.
The CLI provides an easy, interactive way to add components, blocks and pages to your project. Installing components using the CLI ensures that you have the latest version of the component and its dependencies.
init command
You can use the init command to initialize configuration and dependencies for a new project.
The init command installs dependencies, adds the cn util and configures CSS variables for the project.
pnpm dlx shadcn@latest initnpx shadcn@latest initbun x --bun shadcn@latest initYou will be asked a few questions to initialize the project.
add command
You can use the add command to add components, blocks and pages to your project.
The add command installs dependencies, adds the component, block or page to your project and updates the configuration.
pnpm dlx shadcn@latest add https://unlogg.com/r/product-card-01-block.jsonnpx shadcn@latest add https://unlogg.com/r/product-card-01-block.jsonbun x --bun shadcn@latest add https://unlogg.com/r/product-card-01-block.jsonYou can use the same command to add shadcn/ui components.
To see a list of all available options, please refer to the shadcn/ui documentation.
Monorepo support
If you need to install the components in a monorepo, you can use the optional -c flag.
This will allow you to specify the path to the project where you want to install the component.
pnpm dlx shadcn@latest add https://unlogg.com/r/product-card-01-block.json -c ./apps/wwwnpx shadcn@latest add https://unlogg.com/r/product-card-01-block.json -c ./apps/wwwbun x --bun shadcn@latest add https://unlogg.com/r/product-card-01-block.json -c ./apps/wwwRead more about monorepo support using the shadcn CLI in the shadcn/ui documentation.