Skip to content

Vite

Set up RetroUI in a Vite + React project.

1. Create your project

Create a new React + TypeScript project with Vite:

pnpm create vite@latest my-app -- --template react-ts

2. Install Tailwind CSS

pnpm add tailwindcss @tailwindcss/vite

Replace everything in src/index.css with:

src/index.css
@import "tailwindcss";

3. Configure path aliases

Add baseUrl and paths to both tsconfig.json and tsconfig.app.json so the @/* alias resolves:

tsconfig.json
{
  "compilerOptions": {
    "baseUrl": ".",
    "paths": {
      "@/*": ["./src/*"]
    }
  }
}

4. Update vite.config.ts

Install the Node types, then teach Vite to resolve the alias:

pnpm add -D @types/node
vite.config.ts
import path from "path"
import tailwindcss from "@tailwindcss/vite"
import react from "@vitejs/plugin-react"
import { defineConfig } from "vite"
 
export default defineConfig({
  plugins: [react(), tailwindcss()],
  resolve: {
    alias: {
      "@": path.resolve(__dirname, "./src"),
    },
  },
})

5. Run the init

pnpm dlx shadcn@latest init

6. Add the RetroUI registry + theme

Add the RetroUI registries to your components.json, then set up the Fonts & Theme:

components.json
{
  "registries": {
    "@retroui": "https://retroui.dev/r/radix/{name}.json",
    "@retroui-base": "https://retroui.dev/r/base/{name}.json"
  }
}

7. Add a component

pnpm dlx shadcn@latest add @retroui/button

That's it! Add the Radix or Base UI variant of any component the same way.