cnippet/ui
  1. docs
  2. get started

guides

Get Started

Add your first cnippet ui component in minutes.

This guide walks you through adding cnippet ui components to your React project. You'll be up and running in less than 5 minutes.

Prerequisites

Make sure your project meets these requirements:

  • React 18+ (Next.js, Vite, React Router, TanStack Start, Astro — all work)
  • Tailwind CSS v4 – Install Tailwind
  • Node.js (a current LTS release) – for the CLI

Starting a new project, or not sure your setup is ready? Follow the guide for your framework:

Two ways to add components

You can add components automatically with the CLI (recommended) or manually.

Option 1: CLI (fast & automated)

The CLI creates component files, installs dependencies, and sets up CSS variables for you. If your project doesn't have a components.json yet, run npx shadcn@latest init first.

Add a single component

This creates components/ui/button.tsx and installs any required packages (e.g., @base-ui/react).

Add multiple components

Add all UI components at once

Adds all 55+ core components – perfect for starting a new project.

This replaces the default colors in your global CSS with the cnippet ui tokens, including the info, success and warning colors. See Colors for every token.

Set up everything in one command

Sets up components.json, the color tokens, fonts, base styles and every component.

What the CLI does for you:

  • Creates components/ui/ folder (if missing)
  • Adds the component file with correct imports
  • Installs npm dependencies
  • Updates your CSS with required variables (when using color tokens)

See the CLI reference for every command and option, and components.json for the config file.

Option 2: Manual copy (full control)

Prefer to copy-paste manually? Here's how:

  1. Set up the dependencies, the cn helper and the CSS tokens from Manual Installation.
  2. Browse the Components page and pick one (e.g., Button).
  3. In the Installation section, choose Manual and copy the code.
  4. Create a new file in your project, e.g., components/ui/button.tsx, and paste the code.
  5. Install the dependencies listed on the component's page.
  6. Import and use the component:

Styling and dark mode

Components are styled with Tailwind CSS classes and a set of CSS variables for colors and radius. Every token has a light and a dark value, so dark mode works as soon as a dark class is on <html>.

  • Colors lists every token with its light and dark value.
  • Theming shows how to change colors and radius.
  • Dark Mode sets up theme switching for your framework.

Verify your setup

After adding a component, test it on a page:

If you see styled buttons, everything works. If something is wrong, see the FAQ for fixes to common problems, like a missing import alias or unstyled components.

Next steps

  • Browse all Components
  • Learn about Theming – custom colors and radius
  • See Blocks for full page examples built with cnippet ui

Need help?

Happy building!