ui

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 App Router, Remix, Vite — all work)
  • Tailwind CSS v4Install Tailwind
  • Node.js 18+ – for the CLI

No existing Tailwind project? Create one quickly:

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.

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 installs both the components and our default zinc-based color system. The CSS variables are automatically added to your globals.css. See the Styling guide for details.

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)
  • No extra config files – your project stays clean

Option 2: Manual copy (full control)

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

  1. Browse the Components page and pick one (e.g., Button).
  2. Click the Code tab to see the source.
  3. Copy the entire component code.
  4. Create a new file in your project, e.g., components/ui/button.tsx, and paste the code.
  5. Check the component's page for any required dependencies – install them with npm/yarn/pnpm.
  6. Import and use the component:

Note: If you install manually, you must also add the CSS variables (explained below). The CLI does this automatically.

Styling and CSS variables

Components use Tailwind CSS classes plus a set of CSS variables for theming (colors, borders, shadows, etc.).

Base variables (compatible with shadcn/ui)

Add these to your globals.css:

Extra tokens unique to cnippet ui

For richer feedback states (badges, toasts, alerts):

Dark mode support

Add a .dark class to your root element (or use next-themes) and define dark variables:

All components include dark: modifiers out of the box.

Verify your setup

After adding a component, test it on a page:

If you see styled buttons, everything works. If styles are missing, double-check your CSS variables and Tailwind configuration.

Troubleshooting

"Cannot find module '@/components/ui/button'"

Make sure your tsconfig.json has the path alias:

For Next.js, also add to next.config.js (if using Turbopack):

Styles look broken (no borders, weird colors)

You likely missed the CSS variables. Either:

  • Run npx shadcn@latest add @cnippet/ui @cnippet/colors-zinc to auto-add them, or
  • Manually copy the :root and .dark variable blocks into your globals.css

CLI command fails

Ensure you're using Node.js 18+. If you use pnpm, try pnpm dlx cnippet@latest instead of npx.

I want to remove a component

Simply delete the component file and remove its imports. No package to uninstall – that's the beauty of copy-paste.

Next steps

  • Browse all Components
  • Learn about Styling – custom themes, dark mode, and more
  • See Blocks for full page examples built with cnippet ui

Need help?

  • Open an issue on GitHub
  • Join the discussion – we're responsive

Happy building!