How to use Shadcn CLI

Learn how to use Shadcn CLI to install our components, blocks, and themes into your project seamlessly.

Overview

shadcn/studio uses the shadcn-svelte CLI, offering an easy way to install our components, blocks, and themes. The CLI is designed to help you quickly add ready-to-use assets without the need for NPM packages, following a simple "copy-and-paste" approach. Please refer to the official shadcn-svelte CLI documentation for more details on its core functionality.

Setup

Before using the shadcn/studio CLI, make sure that you've installed shadcn in your project by following the official installation guide.

Installation

You can install components, blocks, and themes using the CLI commands below.

Installing Components

Components are enhanced versions of shadcn/ui components, with added functionality and styling. You can refer to the components documentation for more information.

pnpm dlx shadcn-svelte@latest add https://shadcnstudio-svelte.netlify.app/registry/button-01.json

Installing Blocks

You can refer to the blocks documentation for more information.

pnpm dlx shadcn-svelte@latest add https://shadcnstudio-svelte.netlify.app/registry/hero-01.json

Installing Themes

pnpm dlx shadcn-svelte@latest add https://shadcnstudio-svelte.netlify.app/registry/themes/art-deco.json

Advanced Usage

Installing Multiple Items

You can install multiple items at once by listing them:

pnpm dlx shadcn-svelte@latest add https://shadcnstudio-svelte.netlify.app/registry/button-01 hero-01 themes/art-deco.json

Force Overwriting Existing Files

If you want to overwrite existing files during installation:

pnpm dlx shadcn-svelte@latest add https://shadcnstudio-svelte.netlify.app/registry/button-01.json --overwrite

Troubleshooting

Block/Component/Theme Not Found

Solution:

  • Verify the spelling of the block/component/theme name.
  • Ensure that the block/component/theme exists in the registry.

Best Practices

  1. Regularly update your Shadcn CLI to stay up to date with new features.
  2. Customize components after installation to ensure they match your project's design requirements.