giuseppe-trisciuoglio/developer-kit / plugins/developer-kit-typescript/skills/shadcn-ui
shadcn-ui
VerifiedProvides complete shadcn/ui component library patterns including installation, configuration, and implementation of accessible React components. Use when setting up shadcn/ui, installing components, building forms with React Hook Form and Zod, customizing themes with Tailwind CSS, or implementing UI patterns like buttons, dialogs, dropdowns, tables, and complex form layouts.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 11.3 KB |
| references/chart.md | markdown | 8.1 KB |
| references/charts-components.md | markdown | 5.8 KB |
| references/customization.md | markdown | 4.5 KB |
| references/forms-and-validation.md | markdown | 9.4 KB |
| references/learn.md | markdown | 3.5 KB |
| references/nextjs-integration.md | markdown | 3.9 KB |
| references/official-ui-reference.md | markdown | 51.0 KB |
| references/reference.md | markdown | 14.0 KB |
| references/setup-and-configuration.md | markdown | 5.7 KB |
| references/ui-components.md | markdown | 6.6 KB |
| references/ui-reference.md | markdown | 40.5 KB |
references/nextjs-integration.md
View on GitHub# shadcn/ui - Next.js Integration
## App Router Setup
Most shadcn/ui components require `"use client"` directive when used with App Router. Static display components (Card, Table) can work in Server Components without the directive.
```tsx
// src/components/ui/button.tsx — already includes "use client" after npx shadcn@latest add button
"use client"
import * as React from "react"
// ... rest of component
```
## Root Layout with Toaster
```tsx
// app/layout.tsx
import { Inter } from "next/font/google"
import { Toaster } from "@/components/ui/toaster"
import { cn } from "@/lib/utils"
import "./globals.css"
const inter = Inter({ subsets: ["latin"] })
export default function RootLayout({ children }: { children: React.ReactNode }) {
return (
<html lang="en" suppressHydrationWarning>
<body className={cn("min-h-screen bg-background font-sans antialiased", inter.className)}>
{children}
<Toaster />
</body>
</html>
)
}
```
## Server Components with Interactive Elements
When using interactive shadcn/ui components in Server Components, wrap them in a Client Component:
```tsx
// app/dashboard/page.tsx — Server Component
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"
import { ButtonClient } from "@/components/button-client"
export default function DashboardPage() {
return (
<div className="container mx-auto p-6">
<Card>
<CardHeader>
<CardTitle>Dashboard</CardTitle>
</CardHeader>
<CardContent>
<ButtonClient>Interactive Button</ButtonClient>
</CardContent>
</Card>
</div>
)
}
```
```tsx
// src/components/button-client.tsx — Client Component wrapper
"use client"
import { Button } from "@/components/ui/button"
export function ButtonClient(props: React.ComponentProps<typeof Button>) {
return <Button {...props} />
}
```
## Metadata with shadcn/ui Pages
```tsx
// app/layout.tsx
import { Metadata } from "next"
export const metadata: Metadata = {
title: { default: "My App", template: "%s | My App" },
description: "Built with shadcn/ui and Next.js",
}
```
```tsx
// app/about/page.tsx
import { Metadata } from "next"
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"
export const metadata: Metadata = {
title: "About Us",
description: "Learn more about our company",
}
export default function AboutPage() {
return (
<div className="container mx-auto py-8">
<Card>
<CardHeader><CardTitle>About Our Company</CardTitle></CardHeader>
<CardContent>
<p>We build amazing products with modern web technologies.</p>
</CardContent>
</Card>
</div>
)
}
```
## Dark Mode Setup
### With next-themes
```bash
npm install next-themes
```
```tsx
// components/theme-provider.tsx
"use client"
import { ThemeProvider as NextThemesProvider } from "next-themes"
export function ThemeProvider({ children, ...props }) {
return <NextThemesProvider {...props}>{children}</NextThemesProvider>
}
```
```tsx
// app/layout.tsx
import { ThemeProvider } from "@/components/theme-provider"
export default function RootLayout({ children }) {
return (
<html lang="en" suppressHydrationWarning>
<body>
<ThemeProvider attribute="class" defaultTheme="system" enableSystem>
{children}
</ThemeProvider>
</body>
</html>
)
}
```
### Theme Toggle Component
```tsx
"use client"
import { useTheme } from "next-themes"
import { Button } from "@/components/ui/button"
import { Moon, Sun } from "lucide-react"
export function ThemeToggle() {
const { theme, setTheme } = useTheme()
return (
<Button variant="ghost" size="icon"
onClick={() => setTheme(theme === "dark" ? "light" : "dark")}>
<Sun className="h-4 w-4 rotate-0 scale-100 transition-all dark:-rotate-90 dark:scale-0" />
<Moon className="absolute h-4 w-4 rotate-90 scale-0 transition-all dark:rotate-0 dark:scale-100" />
</Button>
)
}
```
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| brainstormingobra/superpowersYou MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation). | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| brand-guidelinesanthropics/skillsApplies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| frontend-designanthropics/skillsGuidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making choices that don't read as templated defaults. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| mcp-builderanthropics/skillsGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK). | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |