How to use CLI
Learn how to use the shadcn/studio CLI to install components, blocks, and themes into your project seamlessly.
Overview
shadcn/studio enhances the original shadcn/ui CLI, offering an easy way to install custom 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.
Setup
Before using the shadcn/studio CLI, make sure that you've installed shadcn in your project by following the official installation guide.
CLI Versions
There are two CLI versions available to accommodate different user preferences and workflows:
CLI v3
RecommendedCLI v3 allows namespaced registry for easier access:
Configuring CLI v3
To use CLI v3 with our custom content, you need to configure the components.json
file in your project.
For Free Content Only
Access all free components, blocks, and themes without authentication using the free registry.
For Free + Premium Content
Access both free and premium content. Free content works without authentication, premium content requires your credentials:
Environment Variables Setup
You must create or update your .env
file to store your shadcn/studio credentials.
Finding Your Credentials
- Email Address: Your email address used during registration (found in your account settings).
- License Key: Your license key will be found in your billing page.
- Ensure
.env
is added to your.gitignore
to prevent accidental commits of your credentials. - The
EMAIL
andLICENSE_KEY
will automatically be replaced by the CLI.
CLI v2
LegacyCLI v2 requires direct URLs for installation:
Installation
You can install components, blocks, and themes using the CLI commands below.
1. Installing Components
Components are enhanced versions of shadcn/ui components, with added functionality and styling.
@shadcn-studio
for free components only, or @ss-components
for access to both free and premium components (premium ones require authentication).2. Installing Blocks
Free Blocks Only
Free + Premium Blocks
3. Installing Themes
@shadcn-studio
for free themes only, or @ss-themes
for access to both free and premium themes (premium ones require authentication).Free Themes Only
Free + Premium Themes
User-Generated Themes
Package Managers
The Shadcn CLI supports different package managers for your project:
pnpmRecommended
npm
yarn
bun
Advanced Usage
Installing Multiple Items
You can install multiple items at once by listing them:
Force Overwriting Existing Files
If you want to overwrite existing files during installation:
Troubleshooting
1. 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.
2. Access Denied - Missing Credentials
Solution:
- For CLI v3: Ensure your
.env
file containsEMAIL
andLICENSE_KEY
. - For CLI v2: Include
?email={YOUR_EMAIL}&license_key={YOUR_LICENSE_KEY}
in the URL.
3. Invalid Credentials
Solution:
- Double-check your email (it must match your registered account).
- Verify your license key (check your purchase email).
Best Practices
Recommended Practices
- Use CLI v3 for simplicity and ease of use.
- Keep credentials secure by using environment variables or ensuring they aren't saved in command history.
- Regularly update your Shadcn CLI to stay up to date with new features.
- Customize components after installation to ensure they match your project's design requirements.