
Tailwind V4 Shadcn
Customize shadcn/ui on Tailwind v4 with semantic tokens, @theme inline colors, and v3→v4 migration patterns without breaking dark mode.
Overview
Tailwind v4 shadcn is an agent skill for the Build phase that documents advanced Tailwind v4 + shadcn/ui theming, custom semantic colors, and v3→v4 migration patterns.
Install
npx skills add https://github.com/secondsky/claude-skills --skill tailwind-v4-shadcnWhat is this skill?
- Custom semantic colors via :root/.dark CSS variables and @theme inline --color-* mapping
- v3→v4 migration summary: drop tailwind.config.js, @plugin in CSS, @tailwindcss/vite for Vite
- Component rule: prefer semantic tokens (e.g. variant destructive) over hardcoded utility colors
- References full migration guide for v3 → v4 steps
- Dark-mode paired tokens pattern for brand and foreground colors
Adoption & trust: 5.3k installs on skills.sh; 165 GitHub stars; 3/3 security scanners passed (skills.sh audits).
What problem does it solve?
Your shadcn components look wrong after moving to Tailwind v4 because colors are hardcoded or @theme tokens are not wired for dark mode.
Who is it for?
Developers already on or migrating to Tailwind v4 who want shadcn-aligned semantic color and component patterns.
Skip if: Complete beginners needing a from-zero shadcn install tutorial, backend API work, or projects still standardizing on Tailwind v3 without a migration plan.
When should I use this skill?
User asks for custom colors beyond defaults, advanced component patterns, composition best practices, or component customization with Tailwind v4 and shadcn/ui.
What do I get? / Deliverables
You adopt CSS-variable-driven semantic tokens, correct @theme inline mappings, and v4-idiomatic plugin and Vite setup so shadcn variants stay consistent across themes.
- Updated global CSS with @theme and semantic color tokens
- Component examples using semantic variants
- Migration notes aligned to references/migration-guide.md
Recommended Skills
Journey fit
How it compares
Styling and design-token reference for shadcn on v4—not a component library installer or Figma handoff skill.
Common Questions / FAQ
Who is tailwind-v4-shadcn for?
Solo builders and small teams implementing or customizing shadcn/ui on Tailwind v4 who understand React and CSS variables but want v4-specific @theme and migration guardrails.
When should I use tailwind-v4-shadcn?
During Build frontend when adding custom brand colors, fixing post-migration styling, or reviewing advanced shadcn composition on a Vite + Tailwind v4 stack.
Is tailwind-v4-shadcn safe to install?
It is documentation-style guidance with no implied remote calls; still review the Security Audits panel on this Prism page before enabling broad filesystem edits in your repo.
SKILL.md
READMESKILL.md - Tailwind V4 Shadcn
# Advanced Usage Patterns **Purpose**: Advanced customization and component patterns for experienced Tailwind v4 + shadcn/ui developers **When to Load**: User asks for custom colors beyond defaults, advanced component patterns, composition best practices, or component customization --- ## Custom Colors Add new semantic colors beyond the default palette: ```css :root { --brand: hsl(280 65% 60%); --brand-foreground: hsl(0 0% 100%); } .dark { --brand: hsl(280 75% 70%); --brand-foreground: hsl(280 20% 10%); } @theme inline { --color-brand: var(--brand); --color-brand-foreground: var(--brand-foreground); } ``` **Usage:** ```tsx <div className="bg-brand text-brand-foreground">Branded Component</div> ``` **Key Pattern**: Define CSS variable in `:root`/`.dark`, then reference in `@theme inline` with `--color-` prefix. --- ## Migration from Tailwind v3 For complete v3 → v4 migration steps, see `references/migration-guide.md`. **Quick Summary**: - Remove `tailwind.config.js` (v4 uses CSS configuration) - Convert hardcoded colors to CSS variables - Update plugin syntax: `require('tailwindcss/plugin')(plugin)` in v3 config → `@plugin "plugin-name"` in CSS - Change Vite plugin: `require('tailwindcss')` or `import tailwindcss from 'tailwindcss'` in v3 → `import tailwindcss from '@tailwindcss/vite'` in v4 --- ## Component Best Practices ### 1. Always Use Semantic Tokens **✅ CORRECT:** ```tsx <Button variant="destructive">Delete</Button> ``` **❌ WRONG:** ```tsx <Button className="bg-red-600">Delete</Button> ``` **Why**: Semantic tokens (`destructive`, `primary`, `secondary`) adapt to theme changes. Hardcoded colors break dark mode and theme customization. --- ### 2. Use `cn()` for Conditional Styling **Import:** ```tsx import { cn } from "@/lib/utils" ``` **Usage:** ```tsx <div className={cn( "base-class", isActive && "active-class", hasError && "error-class" )} /> ``` **What `cn()` does**: Merges Tailwind classes intelligently (later classes override earlier ones). --- ### 3. Compose shadcn/ui Components **Pattern:** ```tsx <Dialog> <DialogTrigger asChild> <Button>Open</Button> </DialogTrigger> <DialogContent> <DialogHeader> <DialogTitle>Title</DialogTitle> </DialogHeader> </DialogContent> </Dialog> ``` **Key Concept**: Use composition (wrapping components) rather than customization (passing props). --- ## Advanced Patterns ### Conditional Theme Variables Apply different variables based on state: ```tsx <div className={cn( "rounded-lg p-4", variant === "success" && "bg-success text-success-foreground", variant === "error" && "bg-destructive text-destructive-foreground" )} /> ``` ### Custom Radius Tokens Add semantic border radius: ```css @theme inline { --radius-sm: 0.25rem; --radius-md: 0.5rem; --radius-lg: 1rem; } ``` Usage: `className="rounded-[var(--radius-lg)]"` ### Component Variants Pattern Use `cva()` from `class-variance-authority` for complex variants: ```tsx import { cva } from "class-variance-authority" const buttonVariants = cva( "inline-flex items-center justify-center rounded-md", { variants: { variant: { default: "bg-primary text-primary-foreground", destructive: "bg-destructive text-destructive-foreground", }, size: { default: "h-10 px-4 py-2", sm: "h-9 px-3", lg: "h-11 px-8", }, }, defaultVariants: { variant: "default", size: "default", }, } ) ``` --- ## Official Resources - Tailwind v4 Docs: https://tailwindcss.com/blog/tailwindcss-v4-beta - shadcn/ui: https://ui.shadcn.com - class-variance-authority: https://cva.style/docs # Common Gotchas & Solutions ## Critical Failures (Will Break Your Build) ### 1. `:root` Inside `@layer base` ❌ **WRONG:** ```css @layer base { :root { --background: hsl(0 0% 100%); } } ``` ✅ **CORRECT:** ```css :root { --background: hsl(0 0% 100%); } @layer base { body { background-col