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/ui 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/ui 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.
shadcn CLI Support
There are two CLI versions available to accommodate different user preferences and workflows:
shadcn CLI v3
RecommendedGround-up rewrite focused on registries at scale (namespaces, auth, private/pro) and AI/automation (MCP).
Registry Structure Explanation
We provide multiple registries to organize content by type and access level. Here's why each registry exists:
Namespace | Content Type |
---|---|
@shadcn-studio | Free components, blocks, themes |
@ss-components | Free + premium components |
@ss-blocks | Free + premium blocks |
@ss-themes | Free + premium + user-generated themes |
Key Benefits of Multiple Registries:
- Simplified Access: Use
@shadcn-studio
for quick access to any free content - Category Organization: Category-specific registries (
@ss-components
,@ss-blocks
,@ss-themes
) provide better content management - Premium Support: Category-specific registries support both free and premium content with proper authentication
- User Content:
@ss-themes
also includes user-generated themes alongside official content
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.
shadcn CLI v2
LegacyLegacy shadcn CLI version. CLI v2 requires direct URLs for installation:
For Free Content Only
Access all free components, blocks, and themes without authentication using direct URLs.
For Free + Premium Content
Access premium content by adding your credentials as URL parameters to the installation command. The free content works without authentication as mentioned above.
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.
Free Components Only
Premium Components
Installing Blocks
You can refer to the blocks documentation for more information.
Free Blocks Only
Premium Blocks
Installing Themes
You can refer to the themes documentation for more information.
You need to manually install the font dependencies and add them to your layout file, as they are not included in the themes. You can find the fonts from Google Fonts.
Free Themes Only
Premium Themes
User-Generated Themes
Package Managers
The Shadcn CLI supports different package managers for your project:
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
- 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.