cnippet/ui
  1. docs
  2. components json

guides

components.json

What each field in components.json does, and which ones matter for cnippet ui.

components.json tells the shadcn CLI how your project is set up: where your CSS lives, which import aliases to use and which registries to install from. The CLI reads it every time you run add.

You only need it if you use the CLI. If you copy components by hand, you can skip it.

npx shadcn@latest init creates it for you. A typical file for cnippet ui looks like this:

components.json

$schema

Points to the JSON Schema, so your editor autocompletes and checks the file.

style

The shadcn/ui style, for example new-york or base-nova. It can't be changed after init.

It only changes shadcn/ui components. cnippet ui components are the same whatever style you choose. If you pick a style during init, choose a base-* one so shadcn/ui components are built on Base UI too.

tailwind

How Tailwind CSS is set up in your project.

rsc

Set to true if you use React Server Components (Next.js App Router), and false for Vite, React Router in SPA mode and other client-only setups.

When it's true, the CLI keeps the "use client" line at the top of components. When it's false, it removes it. Every cnippet ui component that needs it already has the directive.

tsx

Set to false to get JavaScript (.jsx) files instead of TypeScript. The CLI strips the types when it writes each component.

iconLibrary

The icon library for shadcn/ui components. Keep it as lucide. cnippet ui components import their icons from lucide-react.

aliases

The import paths for each kind of file. The CLI uses them to decide where to write files and to rewrite imports inside the components it installs.

The aliases must also resolve in TypeScript and your bundler, usually through paths in tsconfig.json:

tsconfig.json

To put cnippet ui components somewhere else, change ui. For example, "ui": "@/components/cnippet" writes them to components/cnippet/ and imports them from there. This is also how you keep cnippet ui and shadcn/ui components apart: both would otherwise write components/ui/button.tsx.

Instead of paths, you can use package.json imports (#components/*). Set the aliases to match, for example "ui": "#components/ui".

registries

Named registries you can install from with @name/item:

components.json

{name} is replaced by the item name, so @cnippet/button loads https://ui.cnippet.dev/r/button.json.

@cnippet is in the shadcn registry index, so it works without this entry in current versions of the CLI. Add it if you use the MCP server, pin an older CLI, or want the setup written down in your project. npx shadcn@latest registry add @cnippet adds it for you.

A registry can also be an object with request headers, for a private registry:

components.json

${VAR} values are read from your environment variables.

Other fields