Skip to content

Docs

Configuration

The CLI reads a single file — components.json at your project root — to learn where to write components, which import paths to generate, and which registries to resolve. Get this file right once and every install after it just works.

What components.json controls#

  • style — the base component style (DavinciUI uses new-york).
  • tailwind / cssVariables — whether components use CSS-variable-driven theming.
  • aliases — the import paths generated in installed files. These must match your tsconfig.json paths.
  • registries — named URL templates so the CLI can resolve @davinciui/*.

Info

Only needed if you use the CLI — manual copy-paste does not require this file.

Minimal working configuration#

Generated by pnpm dlx shadcn@latest init, then extended with the DavinciUI registry. The annotated fields below are the ones that matter for DavinciUI:

{
  "$schema": "https://ui.shadcn.com/schema.json",
  "style": "new-york",
  "rsc": true,
  "tsx": true,
  "tailwind": {
    "config": "",
    "css": "app/globals.css",
    "baseColor": "neutral",
    "cssVariables": true
  },
  "aliases": {
    "components": "@/components",
    "utils": "@/lib/utils",
    "ui": "@/components/ui"
  },
  "registries": {
    "@davinciui": "https://davinciui.com/r/{name}.json"
  }
}
  • tailwind.css points at the stylesheet holding your theme tokens.
  • tailwind.cssVariables: true keeps components theme-aware (see Theming).
  • rsc / tsx reflect a React Server Components + TypeScript project.

Registry configuration#

The namespace scopes third-party registries so names never clash with your local components. {name} is a placeholder the CLI replaces with the component slug:

{
  "registries": {
    "@davinciui": "https://davinciui.com/r/{name}.json"
  }
}

Why this matters: without it, shadcn add @davinciui/text-morph has nowhere to download from. How resolution works is covered in Registry.

Alias configuration#

Aliases decide the import paths written into installed files. They must match the paths in your tsconfig.json:

{
  "aliases": {
    "components": "@/components",
    "utils": "@/lib/utils",
    "ui": "@/components/ui"
  }
}

Typical mapping: @/components → ./components. If you use a different prefix (for example ~/), set it here and in tsconfig.json together.

Project structure and installation destination#

With the aliases above, installing @davinciui/text-morph writes to:

components/
  ui/
    text-morph.tsx   # installed source — yours to edit
lib/
  utils.ts           # cn() helper (created by shadcn init)

Imports in the installed file reference @/components/ui/… and @/lib/utils exactly as configured — which is why aliases and tsconfig paths must agree.

Configuration for existing projects#

  • Run pnpm dlx shadcn@latest init in the existing repo and answer the prompts to match your setup.
  • Point tailwind.css at your real global stylesheet, not the default suggestion, if it differs.
  • Keep your existing path alias: if the project uses ~/ instead of @/, configure that alias instead of renaming imports.
  • Add the registries block manually if your components.json predates it.

Validation checklist#

  • components.json exists at the project root and parses as JSON.
  • registries["@davinciui"] equals https://davinciui.com/r/{name}.json.
  • Every alias in components.json has a matching entry in tsconfig.json paths.
  • tailwind.css points at a stylesheet that exists and is imported by the app.
  • A test install (add @davinciui/text-morph) lands files under the aliased directory.

Troubleshooting#

  • CLI ignores your paths — you edited tsconfig.json but not components.json aliases (or vice versa). Change both.
  • Styles missing after install — tailwind.css points at the wrong file, or the stylesheet is not imported. Verify the path and the import.
  • Unthemed components — cssVariables is false. Set it to true and see Theming.

Full spec at ui.shadcn.com/docs/components-json.