Shadcn CLI

Install any block with the Shadcn CLI. Free blocks install from a URL with no setup; blocks you own install by name once you have added the registry and your API key.

The Shadcn CLI is part of the shadcn/ui open source project. For the full command reference and init options, see the Shadcn CLI docs.

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:

Terminal
npx shadcn@latest add "https://www.shadcn-ui-blocks.com/r/<block>.json"

Blocks you own

Paid blocks are served from the @shadcn-ui-blocks registry and authorized with an API key. Set it up once, then install any block you own by name.

  1. 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. 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. 3

    Add your key

    Put the key in .env.local so it is never committed. The CLI reads it from the environment.

    .env.local
    SHADCN_UI_BLOCKS_API_KEY=sk_live_your_key_here
  4. 4

    Install a block

    Install any block you own 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_KEY is set in .env.local and that the components.json header matches it, then run the command again from your project root.
  • 403 Forbidden. The key is valid, but the account does not own this collection. Buy the plan that includes it, or use a key from an account that owns it.
  • Key not picked up. Some shells cache the environment. Open a fresh terminal after editing .env.local and try again.