Frontend
shadcn/ui
Beautiful UI components with shadcn/ui
shadcn/ui
TurboKit includes shadcn/ui setup for beautiful, accessible UI components.
Configuration
The components.json file configures shadcn/ui:
{
"$schema": "https://ui.shadcn.com/schema.json",
"style": "new-york",
"rsc": true,
"tsx": true,
"tailwind": {
"config": "",
"css": "app/globals.css",
"baseColor": "neutral",
"cssVariables": true
},
"aliases": {
"components": "@/components",
"utils": "@/lib/utils",
"ui": "@/components/ui"
},
"iconLibrary": "lucide"
}Adding Components
Use the CLI to add components:
cd apps/web
# Add a button component
npx shadcn@latest add button
# Add a form component
npx shadcn@latest add form
# Add multiple components
npx shadcn@latest add input label cardUsage
Import and use components:
import { Button } from "@/components/ui/button";
import { Input } from "@/components/ui/input";
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
export function LoginForm() {
return (
<Card>
<CardHeader>
<CardTitle>Login</CardTitle>
</CardHeader>
<CardContent>
<Input placeholder="Email" type="email" />
<Input placeholder="Password" type="password" />
<Button>Sign In</Button>
</CardContent>
</Card>
);
}Utility Function
The cn() utility merges Tailwind classes:
// lib/utils.ts
import { type ClassValue, clsx } from "clsx";
import { twMerge } from "tailwind-merge";
export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs));
}Usage:
import { cn } from "@/lib/utils";
<div className={cn("p-4", isActive && "bg-primary")} />;Note: For Tailwind CSS v4, leave the
tailwind.configfield empty incomponents.json.