guides
Vite
Install and configure cnippet ui in a Vite + React project.
cnippet ui is installed with the shadcn CLI. A new Vite project needs Tailwind CSS and an @ import alias first.
Create a project
If you already have a Vite app, skip this step. Choose the React framework and the TypeScript variant.
Add Tailwind CSS
Replace everything in src/index.css with:
Edit tsconfig.json
Vite splits the TypeScript config across several files. Add baseUrl and paths to the compilerOptions of tsconfig.json:
Edit tsconfig.app.json
Add the same alias so your editor resolves the imports:
Update vite.config.ts
Install the Node types, then add the Tailwind plugin and the @ alias:
Run the CLI
This creates components.json, adds src/lib/utils.ts and sets up the CSS variables in src/index.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
Install everything at once
To add the full theme and every component in one command, run init with the cnippet ui style after the Update vite.config.ts step:
Next steps
- Set up Dark Mode. Vite has no
next-themes, so the guide includes a small theme provider and a script that prevents a flash of the wrong theme. - Browse all Components.