Capítulo 104 de 108
Namespaced registries (@name) let one project configure and consume multiple resource sources (components, hooks, AI prompts, themes, config) at once — a decentralized system with no central naming authority, resolved via components.json#registries.
@namespace/resource-name; name must start with @, contain only alphanumerics/hyphens/underscores. Parser regex: /^(@[a-zA-Z0-9](?:[a-zA-Z0-9-_]*[a-zA-Z0-9])?)\/(.+)$/.@namespace you want; a central open-source index exists only as an opt-in shortcut (see Registry Directory).{name} (required) is replaced with the resource name; {style} (optional) is replaced with the project's configured style (e.g. new-york), letting a registry serve per-style variants.url, headers, and params for auth/versioning.owner/repo/item (no config needed) for public GitHub repos; use @namespace when you need a stable alias, custom hosting, auth, headers, params, or private-registry support.add @namespace/resource clears registry context → fetches the main resource → recursively resolves registryDependencies from their respective registries → topologically sorts → deduplicates files by target path (last one wins) → deep-merges configs (tailwind, cssVars, css, envVars).registryDependencies: ["@vendor/original"] plus your own cssVars/files — installs the original then overlays your changes (last-resolved wins on same target path).params: No built-in version field; registries implement versioning themselves via query params (params: { "version": "v2" } or ${REGISTRY_VERSION} env-driven).{
"registries": {
"@acme-ui": "https://registry.acme.com/ui/{name}.json",
"@acme-internal": {
"url": "https://internal.acme.com/registry/{name}.json",
"headers": { "Authorization": "Bearer ${INTERNAL_TOKEN}" }
}
}
}
{
"name": "custom-button",
"type": "registry:ui",
"registryDependencies": ["@vendor/button"],
"cssVars": { "light": { "--button-bg": "purple" } }
}
@vendor/button) e sobrescreve só o cssVars, sem duplicar os arquivos.npx shadcn@latest add @v0/dashboard
npx shadcn@latest add @acme/header @lib/auth-utils @ai/chatbot-rules
npx shadcn@latest view @acme/button
npx shadcn@latest search @acme --query "auth"
add, view, search) operando com sintaxe de namespace, incluindo instalação múltipla cross-registry numa chamada só.| Placeholder | Required | Resolves to |
|---|---|---|
{name} | Yes | resource name from @namespace/resource-name |
{style} | No | project's configured style (e.g. new-york) |
| CLI command | Purpose |
|---|---|
add @ns/item | install (accepts URL, local file, or namespace) |
view @ns/item | inspect payload before installing |
search @ns --query X | search within a registry |
list @ns | alias for search with no query |
registry add @ns=URL_TEMPLATE | register a namespace in components.json |
components.json: always ${VAR} + .env.local; the CLI never logs expanded env var values.registryDependencies entry wins on same target path — list overrides last, originals first.@namespace must be explicitly configured.components.json#registries; no separate MCP or auth config format exists.npx shadcn@latest view @ns/item is the safe way to inspect a registry item's full payload before installing — resources are validated JSON data, never executed as code.components.json snippet needed; missing env vars name the exact variable; 401/403 map to auth/permission issues respectively.headers/params auth patterns referenced here.registryDependencies field accepts namespace addresses per this spec.@namespace syntax.