Shadcn CLI
Install any block with the Shadcn CLI. Free blocks install from a URL with no setup; premium and standard blocks install by name once you have added the registry and an API key from your plan.
How it works
The CLI reads your project's components.json, fetches the block from our registry, and integrates it into your codebase. For each block it:
- writes the block's source into your project at the right paths;
- installs any npm dependencies the block needs;
- adds the shadcn/ui components it builds on, like Button or Card;
- respects your aliases, style, and Tailwind setup, so the code fits your project.
Free blocks
Blocks in the free collections need no account or key. On a block's Code tab, copy the command and run it. It installs straight from the block's URL:
npx shadcn@latest add "https://www.shadcn-ui-blocks.com/r/<block>.json"Premium and standard blocks
Premium and standard blocks are served from the @shadcn-ui-blocks registry and authorized with an API key from a Pro or Team account. Set it up once, then install any block your plan covers by name.
- 1
Create an API key
Go to API keys in your account and create one. It is shown only once, so copy it straight away. Keys look like
sk_live_…. - 2
Register the namespace
Add the registry to your project's
components.json. The CLI swaps{name}for the block you install.components.json{ "registries": { "@shadcn-ui-blocks": { "url": "https://www.shadcn-ui-blocks.com/r/{name}.json", "headers": { "Authorization": "Bearer ${SHADCN_UI_BLOCKS_API_KEY}" } } } } - 3
Add your key
Put the key in
.env.localso it is never committed. The CLI reads it from the environment..env.localSHADCN_UI_BLOCKS_API_KEY=sk_live_your_key_here - 4
Install a block
Install any block your plan covers by name:
npx shadcn@latest add @shadcn-ui-blocks/modern-saas-hero-sections-centered-with-backdrop
Troubleshooting
- 401 Unauthorized. The key is missing or invalid. Check that
SHADCN_UI_BLOCKS_API_KEYis set in.env.localand that thecomponents.jsonheader matches it, then run the command again from your project root. - 403 Forbidden. The key is valid, but the account has no plan that covers this collection. Start Pro or Team, or use a key from an account that has one.
- Key not picked up. Some shells cache the environment. Open a fresh terminal after editing
.env.localand try again.