Install UI Pro blocks with the shadcn CLI
Set up the @themesdev registry once with an API key in .env.local, then install any block with one npx shadcn command. Free items need no key.
- shadcn 4.23.0
- www.themes.dev registry
UI Pro blocks install with the shadcn CLI from our registry, @themesdev. You do three things once per project: make an API key in your account, put it in .env.local as THEMESDEV_TOKEN, and add the registry to components.json. After that, every block's page shows a line like npx shadcn@latest add @themesdev/hero-03 that you paste into your terminal. Free items need none of this: they install from a public URL, without an account.
Before you start
You need a project with shadcn/ui set up, on Tailwind CSS v4: a components.json in the root. If you don't have one yet, npx shadcn@latest init creates it; -t vite, -t next and -t astro scaffold a new project with it. Our blocks are React components, so an Astro project also needs the React integration (npx astro add react). shadcn/ui in Astro covers that setup.
Set up the registry once
Step 1: Make an API key
Sign in on your account page, open API keys, give the key a name (the machine or project it's for) and copy it. It's shown once. A key carries exactly your access, so make one per machine or project, and revoke it there if it leaks.
Step 2: Put it in .env.local
.env.localShell THEMESDEV_TOKEN=tdk_…The shadcn CLI reads
.envand.env.localfrom the project folder. Make sure.env.localis in.gitignore; Vite and Next.js projects ignore it by default.Step 3: Add the registry to components.json
components.jsonJSON { "registries": { "@themesdev": { "url": "https://www.themes.dev/r/ui/{name}.json", "headers": { "Authorization": "Bearer ${THEMESDEV_TOKEN}" } } }}Add the
registrieskey next to what's already in the file. The${THEMESDEV_TOKEN}stays literally like that: the CLI fills it in from your environment, so the key never ends up in the file.
Install a block
Copy the install line from the block's page, or use its store number:
npx shadcn@latest add @themesdev/hero-03pnpm dlx shadcn@latest add @themesdev/hero-03yarn dlx shadcn@latest add @themesdev/hero-03bunx shadcn@latest add @themesdev/hero-03The CLI writes the block to components/<category>/ (for hero-03: src/components/heroes/hero-corra.tsx), adds the shadcn primitives it uses to components/ui/ and installs packages such as lucide-react. If one of those primitives already exists in your project, it asks before overwriting; answer no to keep your version. Run with --dry-run first if you want to see the file list.
Then import it like any component and pass your own content as props:
import { HeroCorra } from "@/components/heroes/hero-corra" export default function Page() { return <HeroCorra title="Your headline" />}Each block exports its props type and its defaults, so your editor shows what you can change. Photos point to our media server at first, so the block looks right straight away. Replace them with your own before you launch.
Free items: no key needed
Free blocks and components install from a public URL, with or without the registry entry. The free library pages show that line:
npx shadcn@latest add https://www.themes.dev/r/ui/pricing.jsonpnpm dlx shadcn@latest add https://www.themes.dev/r/ui/pricing.jsonyarn dlx shadcn@latest add https://www.themes.dev/r/ui/pricing.jsonbunx shadcn@latest add https://www.themes.dev/r/ui/pricing.jsonOne thing to know: once your components.json has the @themesdev entry with its header, the CLI won't run any @themesdev/… command without THEMESDEV_TOKEN set, free items included. Full URLs keep working.
From an AI assistant
We also run an MCP server at https://www.themes.dev/mcp, so an AI assistant that supports MCP can list, search and show items and install them for you (its tools are list_items, search_items, show_item and install_item). The account page has the config to paste, with the same THEMESDEV_TOKEN.
When it doesn't work
| Message | What it means |
|---|---|
Registry "@themesdev" requires the following environment variables: THEMESDEV_TOKEN | The CLI didn't find the key. Check the variable name and that .env.local is in the folder you run the command in. |
[Unauthorized] This is a UI Pro item… | No valid key was sent, or the key's account has no UI Pro licence. Make a new key on the account page and check that the license shows there. |
The file button.tsx already exists. Would you like to overwrite? | Not an error: the block uses a primitive you already have. No keeps yours. |
For updates later, the same commands with --diff show what changed in a block since you installed it. Updating components explains how to take changes without losing your edits.
Questions
Can my whole team use one key?
No. Each person with a seat makes their own key from their own account. Keys are personal, and sharing one between people isn't allowed by the licence. For CI, make a key for that pipeline from the account of the person who owns it.
Do the blocks work in Next.js and Astro?
Yes. They're React components on shadcn/ui and Tailwind CSS v4. In Astro they render to HTML at build time, and only blocks with interactive parts need a client: directive.
What if I don't want to use the CLI?
The account page also has the full UI Pro download, with every block as source files. Copy the ones you want into your project.
Related articles
- shadcn/uiInstall components from a shadcn registry (npx shadcn add @namespace)Install by URL with no setup, or name a registry in components.json and install by namespace. Private registries read their key from .env.local.
- shadcn/uiHow to update shadcn/ui components without losing your changesThere is no update command: use add --dry-run and --diff to see changes, --overwrite to take them, and Git to put your own edits back.
- shadcn/uishadcn blocks vs components: what is the difference?A component is one interface part, a block is a finished section built from several. How primitives, components, blocks and page templates fit together.
Still stuck? We answer every message ourselves. Write to us