How to use the Shadcn CLI
The Shadcn CLI is the primary way to install Shadcn Space components, blocks, and templates into your project. It allows you to add production-ready UI directly into your codebase while preserving full control and customization.
Overview
Shadcn Space CLI is built on top of the official Shadcn UI CLI, so the workflow feels instantly familiar if you’ve used Shadcn before. Instead of installing components as opaque NPM packages, the CLI copies real, readable code directly into your project.
This approach follows the copy-and-paste philosophy of Shadcn UI — giving you complete ownership over styles, logic, and structure. You can modify, extend, or refactor the generated components without worrying about breaking upstream dependencies.
For a deeper understanding of the core CLI mechanics, refer to the official Shadcn UI CLI documentation.
Setup
Before using Shadcn Space with the CLI, you must have Shadcn UI installed and configured in your project. This includes Tailwind CSS, the required path aliases, and the base configuration files.
If you haven’t set this up yet, please follow the below guide.
Using the New “Create Project” Feature
Shadcn now provides a visual Create Project experience that allows you to configure your setup before generating the CLI command. Instead of manually initializing everything, you can select your preferred component library, style system, icon library, theme, and more — then copy the generated command.
- Visit ui.shadcn.com/create and open the configuration panel.
- Choose your preferred configuration:
Select your Component Library: Base UI (recommended)
Base UIRadix UISelect your Visual Style:
VegaThe classic shadcn/ui look. Clean, neutral, and familiar.NovaReduced padding and margins for compact, data-heavy layouts.MaiaSoft and rounded, featuring generous spacing and curves.LyraBoxy and sharp. Pairs exceptionally well with mono fonts.MiraUltra-compact. Engineered for dense professional interfaces.Select your Base Color:
NeutralZincSlateZincGraySelect your Theme:
NeutralAmberBlueCyanEmeraldFuchsiaGreenIndigoLimeOrangePinkSelect your Icon Library:
LucideTabler IconsHeroiconsPhosphor IconsRemix IconSelect your Font:
InterNoto SansNunito SansFigtreeSelect your Radius:
DefaultNoneSmallMediumLargeSelect your Menu Color:
DefaultInvertedSelect your Menu Accent:
SubtleBold
- Click the Create Project button in the top-right corner.
- Copy the generated CLI command shown on the screen or you can use the command below.
- Open your terminal inside your project directory and paste the command to complete the setup.
Run the following command to create a Next.js + shadcn/ui project.
Once the command finishes running, your project will be fully configured with Shadcn UI and ready to use with Shadcn Space.
If you have already set up your project, and want to migrate from Radix UI to Base UI, you can follow the migration guideMigrating from Radix UI to Base UI.
CLI Versions
Shadcn UI provides multiple CLI versions to support different workflows. Shadcn Space works best with the latest version.
Shadcn CLI v3Recommended
Version 3 introduces namespace-based registries, authentication for private registries, and AI-assisted setup tools. These improvements make it easier to manage multiple component sources and automate repetitive setup tasks.
Shadcn Space leverages this namespace system to distribute both free and premium components in a scalable and maintainable way.
| Registry | Includes |
|---|---|
| @shadcn-space | Free and premium layout blocks, components, and templates |
Configure Shadcn CLI v3
Shadcn CLI v3 supports custom registries through namespaces. By configuring a registry, you can install both free and premium Shadcn Space components directly into your project.
Step 1: Update components.json
Add the @shadcn-space registry to your components.json file. This tells the CLI where to fetch components and how to authenticate premium requests.
Step 2: Set Environment Variables
Premium components require authentication. Store your credentials securely using environment variables instead of hardcoding them.
Find Your Credentials
You’ll need the following details to access premium resources:
- Email address: Use the email associated with your Shadcn Space account.
- License key: Available in your Dashboard.
- Ensure
.envis added to your.gitignoreto prevent accidental commits of your credentials. - The EMAIL and LICENSE_KEY will automatically be replaced by the CLI.
Never commit your credentials to a repository. Always use environment variables for CLI v3, or be cautious with URL parameters in CLI v2 commands.
Installing Components & Blocks
Shadcn Space supports both Shadcn CLI v3 and v2. We recommend using CLI v3 for new projects, but v2 remains supported for legacy setups.
Using Shadcn CLI v3
RecommendedCLI v3 introduces namespace-based registries. Once you’ve configured the @shadcn-space registry, you can install both free and premium components using simple commands.
Install a component
Install a block
Using Shadcn CLI v2
LegacyCLI v2 does not support namespaces. Components and blocks are installed using direct registry JSON URLs. Both free and premium content are available through separate endpoints.
Install free components
Install premium components or blocks
Shadcn CLI v3 requires authentication details to be configured in components.json. Make sure you have added your email and license key before installing premium components or blocks.
Note: Premium installs via CLI v2 require valid credentials configured in your environment variables. CLI v3 is recommended for a smoother and more secure experience.
Package Managers
Install components and blocks using your preferred package manager. The Shadcn CLI works the same across all managers — choose the one that matches your project setup.
Run the following command to install the selected component directly into your project.
Tip: The CLI automatically fetches files from your configured registry in components.json.
Advanced Usage
The Shadcn CLI supports advanced workflows that help you move faster while maintaining full control over your codebase.
Installing Multiple Items
You can install multiple components or blocks in a single command. This is useful when setting up a new page or feature.
Force Overwriting Existing Files
If a component already exists, the CLI will prompt before overwriting. You can skip prompts and force updates using the--overwrite flag.
Troubleshooting
If you encounter issues while installing components, the solutions below should resolve most common problems.
Block / Component / Theme Not Found
This usually means the requested item name is incorrect or the registry is not configured properly.
Solution:
- Verify the component or block name in the documentation.
- Ensure
components.jsonincludes the@shadcn-spaceregistry. - Check your internet connection.
Access Denied – Missing Credentials
Premium components require authentication.
Solution:
- Add
EMAILandLICENSE_KEYto your.envfile. - Restart the CLI after updating environment variables.
- Ensure you are using CLI v3.
Invalid Credentials
This occurs when provided credentials are incorrect or expired.
Solution:
- Double-check your email and license key in
.env. - Regenerate your license key from the dashboard if needed.
- Ensure there are no extra spaces or quotes.
Best Practices
- Use Shadcn CLI v3 for the simplest setup, namespace support, and secure access to premium registries.
- Keep credentials secure by storing them in environment variables and ensuring they are not hardcoded or saved in command history.
- Regularly update the Shadcn CLI to stay up to date with new features, fixes, and improvements.
- Customize components after installation to ensure they match your project’s design system and functional requirements — you fully own the code.