How to apply a shadcn preset to a new or existing project
October 23, 2026 · 5 min read
Once you have a preset code, applying it takes one command. The exact command depends on whether you are starting a new project or updating one that already uses Shadcn UI. This guide covers both, plus the helper commands for inspecting presets, applying only part of one, and fixing the problems people run into most often.
All examples use npx. If you use another package manager, swap it for pnpm dlx, bunx or yarn dlx. The rest of the command stays the same.
Before you start
You need a preset code. It is a short string like b5owWMfJ8l. You can get one from:
- The preset gallery, where every preset has a copy button
- The preset builder, which generates a code as you choose options
- The preset finder or the random preset tool
If you are not sure what a preset includes, read what is a shadcn preset? first.
Applying a preset to a new project
For a brand new project, use init with the --preset flag:
npx shadcn@latest init --preset b5owWMfJ8l
You can also use create, which accepts the same preset:
npx shadcn@latest create --preset b5owWMfJ8l
Choosing a template
Use -t (or --template) to pick a framework template. Supported values are next, start, vite, react-router, laravel and astro:
npx shadcn@latest create --preset b5owWMfJ8l --template vite
Choosing a component base
Use -b (or --base) to choose which primitive library components are built on: radix (Radix UI), base (Base UI) or aria (React Aria). If you leave it out, shadcn uses Base UI, the default since July 2026. The preset code doesn't store the base, so the same code works with all three.
npx shadcn@latest create --preset b5owWMfJ8l -t next -b base
The base and style together determine the style value written to components.json. For example, a Radix project using the Luma style is stored as:
{
"style": "radix-luma"
}
Other options
--monoreposcaffolds a monorepo (not available for Laravel).--rtlsets up right-to-left support.--pointergives buttons a pointer cursor.
Every preset page on this site has a command builder for these, and remembers your choices.
Installing from a registry URL
Every preset here is also a shadcn registry item, so you can install it by name instead of by code. It follows --base and --pointer like a preset code does:
npx shadcn@latest init --preset https://shadcnpreview.com/r/amber-bakery.json --base radix
Applying a preset to an existing project
If your project already has Shadcn UI set up, use apply:
npx shadcn@latest apply --preset b5owWMfJ8l
This updates your configuration to match the preset: the style, CSS variables for colors and radius, fonts, icon library and menu settings.
Commit your work before running it. Applying a preset can rewrite your global CSS and component files, and a clean git state makes it easy to review the diff or roll back.
Installing just the colors or just the fonts
Often you like a preset's colors but not its fonts, or the other way around. The --only flag limits what gets applied.
Apply just the theme (colors and radius):
npx shadcn@latest apply --preset b5owWMfJ8l --only theme
Apply just the fonts:
npx shadcn@latest apply --preset b5owWMfJ8l --only font
--only theme is the safest option for projects with heavily customized components, since it only touches CSS variables. The difference between the two is explained in presets vs themes.
Copy, don't retype
Preset codes are case-sensitive. b5owWMfJ8l and b5OWwmfj8l are different presets (or invalid ones). Copy codes rather than typing them.
Inspecting presets with the preset commands
The CLI includes a preset command with a few helpful subcommands.
decode
Prints the options inside a code, without changing anything:
npx shadcn@latest preset decode b5owWMfJ8l
For this example you will see style mira, base color mauve, theme mauve, chart color amber, icon library hugeicons, font inter, heading font oxanium, radius large, menu accent subtle and menu color inverted-translucent. More on the format in how shadcn preset codes work.
resolve
Prints the preset code that matches your current project:
npx shadcn@latest preset resolve
In a monorepo, point it at the app directory with -c:
npx shadcn@latest preset resolve -c apps/web
This is useful for sharing your setup, recording it in a README, or recreating it in another project.
url and open
url prints a link to the official shadcn builder with the preset loaded:
npx shadcn@latest preset url b5owWMfJ8l
# https://ui.shadcn.com/create?preset=b5owWMfJ8l
open opens that preset directly:
npx shadcn@latest preset open b5owWMfJ8l
A note on Tailwind v4 and CSS variables
Current Shadcn UI projects use Tailwind CSS v4. Theme colors live as CSS variables in your global stylesheet, in oklch, with one set for light mode and one for dark mode. Tailwind utilities like bg-primary read from those variables.
After applying a preset, your CSS will contain variables like these:
:root {
--radius: 0.875rem;
--background: oklch(1 0 0);
--primary: oklch(...);
--chart-1: oklch(...);
}
.dark {
--background: oklch(...);
--primary: oklch(...);
}
If you want to see the full CSS for a preset without running the CLI, paste the code into our preset decoder. It is also handy when you need to drop the variables into a project that is not managed by the shadcn CLI.
Troubleshooting
"Invalid preset"
Check that you copied the full code with the correct capitalization. You can confirm it parses with npx shadcn@latest preset decode <code>.
Nothing changed after applying
Restart your dev server so new fonts and CSS are picked up. If you used --only, remember that only that part of the preset was applied.
Colors look wrong in dark mode
Make sure your app toggles the dark class (or your configured dark selector) on a parent element. The preset writes both light and dark variables, but your app decides which is active.
Custom components lost changes
If you edited component source files, applying a preset with a different style may overwrite them. Review the git diff and restore your edits, or use --only theme next time.
Icons are missing
The preset may use a different icon library than your project. Make sure the package was installed by the CLI and that existing imports in your own code point to the new library. See shadcn icon libraries compared.
Previewing before you apply
It is easier to commit to a preset after seeing it on real pages. Our preset builder renders blocks from shadcnblocks so you can judge a preset on heroes, pricing and dashboards first.
FAQ
What is the difference between init and apply?
init (or create) sets up a new project with the preset. apply updates an existing Shadcn UI project to match a preset.
Can I use pnpm or bun instead of npx?
Yes. pnpm dlx shadcn@latest, bunx shadcn@latest and yarn dlx shadcn@latest all work with the same arguments.
How do I apply only the colors from a preset?
Run npx shadcn@latest apply --preset <code> --only theme.
How do I find out which preset my project uses?
Run npx shadcn@latest preset resolve in the project root, or add -c <dir> in a monorepo.
Will applying a preset delete my components?
It will not remove your own pages or custom files, but it can rewrite shadcn component files and global CSS. Commit first so you can review the changes.