mirror of
https://github.com/shadcn-ui/ui.git
synced 2026-07-07 22:18:39 +00:00
Compare commits
12 Commits
shadcn@4.0
...
dependabot
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
aa1ec6683e | ||
|
|
bc9f556c38 | ||
|
|
821ac7ee4d | ||
|
|
8df46c4ded | ||
|
|
2303ce2372 | ||
|
|
cf672a9575 | ||
|
|
5ee4567353 | ||
|
|
6f72dba9c4 | ||
|
|
cd717896fa | ||
|
|
d47562cc08 | ||
|
|
aff5d7f0c1 | ||
|
|
4c0be13dcc |
@@ -44,10 +44,12 @@ export async function GET(request: NextRequest) {
|
||||
)
|
||||
}
|
||||
|
||||
track("create_app", {
|
||||
...result.data,
|
||||
preset: presetCode,
|
||||
})
|
||||
if (searchParams.get("track") === "1") {
|
||||
track("create_app", {
|
||||
...result.data,
|
||||
preset: presetCode,
|
||||
})
|
||||
}
|
||||
|
||||
return NextResponse.json(parseResult.data)
|
||||
} catch (error) {
|
||||
|
||||
@@ -6,7 +6,7 @@ date: 2026-03-06
|
||||
|
||||
We're releasing version 4 of shadcn/cli. More capable, easier to use. Built for you and your coding agents. Here's everything new.
|
||||
|
||||
### shadcn/skills
|
||||
## shadcn/skills
|
||||
|
||||
shadcn/skills gives coding agents the context they need to work with your components and registry correctly. It covers both Radix and Base UI primitives, updated APIs, component patterns and registry workflows. The skill also knows how to use the shadcn CLI, when to invoke it and which flags to pass. Agents make fewer mistakes and produce code that actually matches your design system.
|
||||
|
||||
@@ -20,7 +20,7 @@ You can ask your agent things like:
|
||||
npx skills add shadcn/ui
|
||||
```
|
||||
|
||||
### Introducing --preset
|
||||
## Introducing --preset
|
||||
|
||||
A preset packs your entire design system config into a short code. Colors, theme, icon library, fonts, radius. One string, everything included.
|
||||
|
||||
@@ -32,7 +32,7 @@ npx shadcn@latest init --preset a1Dg5eFl
|
||||
|
||||
Use it to scaffold projects from custom config, share with your team or publish in your registry. Drop it in prompts so your agent knows where to start. Use it across Claude, Codex, v0, Replit. Take your preset with you.
|
||||
|
||||
### Switching presets
|
||||
## Switching presets
|
||||
|
||||
When you're working on a new app, it can take a few tries to find something you like so we've made switching presets really easy. Run init --preset in your app, and the cli will take care of reconfiguring everything including your components.
|
||||
|
||||
@@ -40,18 +40,18 @@ When you're working on a new app, it can take a few tries to find something you
|
||||
npx shadcn@latest init --preset ad3qkJ7
|
||||
```
|
||||
|
||||
### Skills + Presets
|
||||
## Skills + Presets
|
||||
|
||||
Your agent knows how to use presets. Scaffold a project, switch design systems, try something new.
|
||||
|
||||
- "create a new next app using --preset adtk27v"
|
||||
- "let's try --preset adtk27v"
|
||||
|
||||
### New shadcn/create
|
||||
## New shadcn/create
|
||||
|
||||
To help you build custom presets, we rebuilt [shadcn/create](/create). It now includes a library of UI components you can use to preview your presets. See how your colors, fonts and radius apply to real components before you start building.
|
||||
|
||||
### New --dry-run, --diff, and --view flags
|
||||
## New --dry-run, --diff, and --view flags
|
||||
|
||||
Inspect what a registry will add to your project before anything gets written. Review the payload yourself or pipe it to your coding agent for a second look.
|
||||
|
||||
@@ -61,7 +61,7 @@ npx shadcn@latest add button --diff
|
||||
npx shadcn@latest add button --view
|
||||
```
|
||||
|
||||
### Updating primitives
|
||||
## Updating primitives
|
||||
|
||||
You can use the `--diff` flag to check for registry updates. Or ask your agent: "check for updates from @shadcn and merge with my local changes".
|
||||
|
||||
@@ -69,7 +69,7 @@ You can use the `--diff` flag to check for registry updates. Or ask your agent:
|
||||
npx shadcn@latest add button --diff
|
||||
```
|
||||
|
||||
### shadcn init --template
|
||||
## shadcn init --template
|
||||
|
||||
`shadcn init` now scaffolds full project templates for Next.js, Vite, Laravel, React Router, Astro and TanStack Start. Dark mode included for Next.js and Vite.
|
||||
|
||||
@@ -91,7 +91,7 @@ Use `--monorepo` to set up a monorepo.
|
||||
npx shadcn@latest init -t next --monorepo
|
||||
```
|
||||
|
||||
### shadcn init --base
|
||||
## shadcn init --base
|
||||
|
||||
Pick your primitives. Use `--base` to start a project with Radix or Base UI.
|
||||
|
||||
@@ -99,7 +99,7 @@ Pick your primitives. Use `--base` to start a project with Radix or Base UI.
|
||||
npx shadcn@latest init --base radix
|
||||
```
|
||||
|
||||
### shadcn info
|
||||
## shadcn info
|
||||
|
||||
The `info` command now shows the full picture: framework, version, CSS vars, which components are installed, and where to find docs and examples for every component. Great for giving coding agents the context they need to work with your project.
|
||||
|
||||
@@ -107,7 +107,7 @@ The `info` command now shows the full picture: framework, version, CSS vars, whi
|
||||
npx shadcn@latest info
|
||||
```
|
||||
|
||||
### shadcn docs
|
||||
## shadcn docs
|
||||
|
||||
Get docs, code and examples for any UI component right from the CLI. Gives your coding agent the context to use your primitives correctly.
|
||||
|
||||
@@ -120,7 +120,7 @@ combobox
|
||||
- api https://base-ui.com/react/components/combobox
|
||||
```
|
||||
|
||||
### registry:base and registry:font
|
||||
## registry:base and registry:font
|
||||
|
||||
Registries can now distribute an entire design system as a single payload using `registry:base`. Components, dependencies, CSS vars, fonts, config. One install, everything set up.
|
||||
|
||||
|
||||
@@ -76,7 +76,7 @@
|
||||
"rehype-pretty-code": "^0.14.1",
|
||||
"rimraf": "^6.0.1",
|
||||
"server-only": "^0.0.1",
|
||||
"shadcn": "4.0.4",
|
||||
"shadcn": "4.0.5",
|
||||
"shiki": "^1.10.1",
|
||||
"sonner": "^2.0.0",
|
||||
"swr": "^2.3.6",
|
||||
|
||||
@@ -539,6 +539,12 @@
|
||||
"url": "https://shadcndesign-free.vercel.app/r/{name}.json",
|
||||
"description": "A growing collection of high-quality blocks and themes for shadcn/ui."
|
||||
},
|
||||
{
|
||||
"name": "@shadcnmaps",
|
||||
"homepage": "https://shadcnmaps.com",
|
||||
"url": "https://shadcnmaps.com/r/{name}.json",
|
||||
"description": "Beautiful map components powered by pure SVG."
|
||||
},
|
||||
{
|
||||
"name": "@shadcnstore",
|
||||
"homepage": "https://www.shadcnstore.com",
|
||||
@@ -868,5 +874,11 @@
|
||||
"homepage": "https://www.fluidfunctionalism.com",
|
||||
"url": "https://www.fluidfunctionalism.com/r/{name}.json",
|
||||
"description": "Fluid components used exclusively in service of functional clarity. Proximity hover, spring animations, font-weight transitions, and animated focus rings."
|
||||
},
|
||||
{
|
||||
"name": "@gammaui",
|
||||
"homepage": "https://www.gammaui.com",
|
||||
"url": "https://www.gammaui.com/r/{name}.json",
|
||||
"description": "Beautifully designed landing page components built with React & Tailwind CSS & Motion."
|
||||
}
|
||||
]
|
||||
|
||||
@@ -630,6 +630,13 @@
|
||||
"description": "A growing collection of high-quality blocks and themes for shadcn/ui.",
|
||||
"logo": "<svg width='80' height='80' viewBox='0 0 80 80' fill='none' xmlns='http://www.w3.org/2000/svg'><g clip-path='url(#clip0_22651_9557)'><g clip-path='url(#clip1_22651_9557)'><rect x='10' y='10' width='60' height='60' fill='black' stroke='#4497F7' stroke-width='5'/><rect x='2.5' y='2.5' width='15' height='15' fill='white' stroke='#4497F7' stroke-width='5'/><rect x='62.5' y='2.5' width='15' height='15' fill='white' stroke='#4497F7' stroke-width='5'/><rect x='2.5' y='62.5' width='15' height='15' fill='white' stroke='#4497F7' stroke-width='5'/><rect x='62.5' y='62.5' width='15' height='15' fill='white' stroke='#4497F7' stroke-width='5'/><path d='M23.75 56.25L56.25 23.75' stroke='white' stroke-width='5'/><path d='M43.75 56.25L56.25 43.75' stroke='white' stroke-width='5'/></g></g><defs><clipPath id='clip0_22651_9557'><rect width='80' height='80' fill='white'/></clipPath><clipPath id='clip1_22651_9557'><rect width='80' height='80' fill='white'/></clipPath></defs></svg>"
|
||||
},
|
||||
{
|
||||
"name": "@shadcnmaps",
|
||||
"homepage": "https://shadcnmaps.com",
|
||||
"url": "https://shadcnmaps.com/r/{name}.json",
|
||||
"description": "Beautiful map components powered by pure SVG.",
|
||||
"logo": "<svg xmlns='http://www.w3.org/2000/svg' width='46.876' height='46.876' viewBox='0 0 12.403 12.403'><path d='M6.201 0A6.21 6.21 0 0 0 0 6.201a6.21 6.21 0 0 0 6.201 6.202A6.21 6.21 0 0 0 12.403 6.2 6.21 6.21 0 0 0 6.2 0m2.977 3.99L7.616 9.573a.62.62 0 0 1-.552.452l-.045.002a.62.62 0 0 1-.567-.368L5.31 7.095 2.743 5.951a.62.62 0 0 1 .086-1.164l5.585-1.562a.62.62 0 0 1 .765.765z'/></svg>"
|
||||
},
|
||||
{
|
||||
"name": "@shadcnstore",
|
||||
"homepage": "https://www.shadcnstore.com",
|
||||
@@ -1014,5 +1021,12 @@
|
||||
"url": "https://www.fluidfunctionalism.com/r/{name}.json",
|
||||
"description": "Fluid components used exclusively in service of functional clarity. Proximity hover, spring animations, font-weight transitions, and animated focus rings.",
|
||||
"logo": "<svg width='40' height='40' viewBox='0 0 40 40' fill='none' xmlns='http://www.w3.org/2000/svg'><rect width='40' height='40' rx='8' fill='var(--foreground)'/><text x='20' y='26' text-anchor='middle' font-size='20' font-weight='700' font-family='system-ui' fill='var(--background)'>F</text></svg>"
|
||||
},
|
||||
{
|
||||
"name": "@gammaui",
|
||||
"homepage": "https://www.gammaui.com",
|
||||
"url": "https://www.gammaui.com/r/{name}.json",
|
||||
"description": "Beautifully designed landing page components built with React & Tailwind CSS & Motion.",
|
||||
"logo": "<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1000 1000'><g><g><path d='M561.27,349.76v-54.72H342.36c-11.96,0-23.77,3.15-33.89,9.51c-21.73,14.52-29.14,36.49-31.32,44.1H561.27z' /><path d='M275.43,358.4s-2.88,38.88,13.68,56.88l65.52,102.96s67.52,41.04,145-5.76s61.64-136.08,61.64-136.08H423.03l-0.72,54.72l74.16,0.72s0,29.52-61.2,48.24c0,0-73.44,14.4-99.36-72c0,0,5.04-37.44-21.6-45.36c-26.64-7.92-38.88-4.32-38.88-4.32z' /></g><path d='M444.63,562.16h-61.92l79.92,130.32s29.52-45.36,12.96-79.2l-30.96-51.12z' /><path d='M471.99,698.24l115.92-186.48V295.04h55.44v229.68l-85.68,138.96s-35.28,61.2-85.68,34.56z' /><path d='M669.27,480.08V295.04h55.44v78.48s2.16,24.48-19.44,51.84l-36,54.72z' /></g></svg>"
|
||||
}
|
||||
]
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
# @shadcn/ui
|
||||
|
||||
## 4.0.5
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#9960](https://github.com/shadcn-ui/ui/pull/9960) [`5ee456735377158c12cf55eefbe872f7303e1325`](https://github.com/shadcn-ui/ui/commit/5ee456735377158c12cf55eefbe872f7303e1325) Thanks [@shadcn](https://github.com/shadcn)! - update handling of init urls
|
||||
|
||||
## 4.0.4
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "shadcn",
|
||||
"version": "4.0.4",
|
||||
"version": "4.0.5",
|
||||
"description": "Add components to your apps.",
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
|
||||
@@ -187,8 +187,11 @@ export const add = new Command()
|
||||
})
|
||||
|
||||
// Resolve registry:base config.
|
||||
const { registryBaseConfig, installStyleIndex } =
|
||||
await resolveRegistryBaseConfig(initUrl, options.cwd)
|
||||
const {
|
||||
registryBaseConfig,
|
||||
installStyleIndex,
|
||||
url: cleanInitUrl,
|
||||
} = await resolveRegistryBaseConfig(initUrl, options.cwd)
|
||||
|
||||
config = await runInit({
|
||||
cwd: options.cwd,
|
||||
@@ -201,7 +204,7 @@ export const add = new Command()
|
||||
cssVariables: true,
|
||||
rtl: false,
|
||||
installStyleIndex,
|
||||
components: [initUrl, ...(options.components ?? [])],
|
||||
components: [cleanInitUrl, ...(options.components ?? [])],
|
||||
registryBaseConfig,
|
||||
})
|
||||
initHasRun = true
|
||||
@@ -228,8 +231,11 @@ export const add = new Command()
|
||||
base: selectedBase,
|
||||
template,
|
||||
})
|
||||
const { registryBaseConfig, installStyleIndex } =
|
||||
await resolveRegistryBaseConfig(initUrl, options.cwd)
|
||||
const {
|
||||
registryBaseConfig,
|
||||
installStyleIndex,
|
||||
url: cleanInitUrl,
|
||||
} = await resolveRegistryBaseConfig(initUrl, options.cwd)
|
||||
|
||||
config = await runInit({
|
||||
cwd: options.cwd,
|
||||
@@ -242,7 +248,7 @@ export const add = new Command()
|
||||
cssVariables: true,
|
||||
rtl: false,
|
||||
installStyleIndex,
|
||||
components: [initUrl, ...(options.components ?? [])],
|
||||
components: [cleanInitUrl, ...(options.components ?? [])],
|
||||
registryBaseConfig,
|
||||
})
|
||||
initHasRun = true
|
||||
|
||||
@@ -384,6 +384,9 @@ export const init = new Command()
|
||||
} else if (options.rtl === false) {
|
||||
url.searchParams.delete("rtl")
|
||||
}
|
||||
if (url.pathname === "/init" && presetArg.startsWith(SHADCN_URL)) {
|
||||
url.searchParams.set("track", "1")
|
||||
}
|
||||
initUrl = url.toString()
|
||||
presetBase = url.searchParams.get("base") ?? undefined
|
||||
} else if (isPresetCode(presetArg)) {
|
||||
@@ -512,12 +515,18 @@ export const init = new Command()
|
||||
}
|
||||
|
||||
// Resolve registry:base config from the first component.
|
||||
const { registryBaseConfig, installStyleIndex } =
|
||||
await resolveRegistryBaseConfig(components[0], cwd, {
|
||||
registries: existingConfig?.registries as
|
||||
| z.infer<typeof registryConfigSchema>
|
||||
| undefined,
|
||||
})
|
||||
const {
|
||||
registryBaseConfig,
|
||||
installStyleIndex,
|
||||
url: cleanUrl,
|
||||
} = await resolveRegistryBaseConfig(components[0], cwd, {
|
||||
registries: existingConfig?.registries as
|
||||
| z.infer<typeof registryConfigSchema>
|
||||
| undefined,
|
||||
})
|
||||
|
||||
// Use the clean URL (track param stripped) for subsequent fetches.
|
||||
components[0] = cleanUrl
|
||||
|
||||
if (!installStyleIndex) {
|
||||
options.installStyleIndex = false
|
||||
|
||||
@@ -3,6 +3,7 @@ import { buildUrlAndHeadersForRegistryItem } from "@/src/registry/builder"
|
||||
import { configWithDefaults } from "@/src/registry/config"
|
||||
import { REGISTRY_URL, SHADCN_URL } from "@/src/registry/constants"
|
||||
import { type registryConfigSchema } from "@/src/registry/schema"
|
||||
import { isUrl } from "@/src/registry/utils"
|
||||
import { createConfig } from "@/src/utils/get-config"
|
||||
import { highlighter } from "@/src/utils/highlighter"
|
||||
import { logger } from "@/src/utils/logger"
|
||||
@@ -141,6 +142,9 @@ export function resolveInitUrl(
|
||||
params.set("template", options.template)
|
||||
}
|
||||
|
||||
// Signal the server to record this init run.
|
||||
params.set("track", "1")
|
||||
|
||||
return `${SHADCN_URL}/init?${params.toString()}`
|
||||
}
|
||||
|
||||
@@ -272,8 +276,25 @@ export async function resolveRegistryBaseConfig(
|
||||
const registryBaseConfig =
|
||||
item?.type === "registry:base" && item.config ? item.config : undefined
|
||||
|
||||
// Strip the track param so subsequent fetches don't re-trigger tracking.
|
||||
let cleanUrl = initUrl
|
||||
if (isShadcnInitUrl(initUrl)) {
|
||||
const url = new URL(initUrl)
|
||||
url.searchParams.delete("track")
|
||||
cleanUrl = url.toString()
|
||||
}
|
||||
|
||||
return {
|
||||
registryBaseConfig,
|
||||
installStyleIndex: item?.extends !== "none",
|
||||
url: cleanUrl,
|
||||
}
|
||||
}
|
||||
|
||||
function isShadcnInitUrl(url: string) {
|
||||
try {
|
||||
return new URL(url).pathname === "/init" && url.startsWith(SHADCN_URL)
|
||||
} catch {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
2
pnpm-lock.yaml
generated
2
pnpm-lock.yaml
generated
@@ -278,7 +278,7 @@ importers:
|
||||
specifier: ^0.0.1
|
||||
version: 0.0.1
|
||||
shadcn:
|
||||
specifier: 4.0.4
|
||||
specifier: 4.0.5
|
||||
version: link:../../packages/shadcn
|
||||
shiki:
|
||||
specifier: ^1.10.1
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
"@eslint/js": "^9.39.1",
|
||||
"eslint": "^9.39.1",
|
||||
"eslint-plugin-react-hooks": "^7.0.1",
|
||||
"eslint-plugin-react-refresh": "^0.4.24",
|
||||
"eslint-plugin-react-refresh": "^0.5.2",
|
||||
"globals": "^16.5.0",
|
||||
"prettier": "^3.8.1",
|
||||
"prettier-plugin-astro": "^0.14.1",
|
||||
|
||||
Reference in New Issue
Block a user