cnippet/ui
  1. docs
  2. installation
  3. react router

guides

React Router

Install and configure cnippet ui in a React Router (framework mode) project.

cnippet ui is installed with the shadcn CLI. React Router's starter already sets up Tailwind CSS v4 and a ~/* import alias, and the CLI picks up that alias automatically.

Create a project

If you already have a React Router app, skip this step.

If you're adding cnippet ui to an older or custom app, make sure Tailwind CSS v4 and an import alias are configured before you continue.

Run the CLI

This creates components.json, adds app/lib/utils.ts and sets up the CSS variables in app/app.css.

Add the cnippet ui theme

This replaces the default colors with the cnippet ui tokens, including info, success and warning. See Colors.

Add components

Components use the ~ alias from your project:

app/routes/home.tsx

Install everything at once

To add the full theme and every component in one command, run init with the cnippet ui style:

Next steps

  • Set up Dark Mode. React Router renders on the server, so follow the section on preventing a flash of the wrong theme.
  • Browse all Components.