Skip to main content
skill CX Codex

shadcn-ui · jezweb — Claude Code skill: React components

Installs and configures shadcn/ui components in a React project: picks them by task, keeps install order and dependencies straight.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add jezweb/claude-skills --skill shadcn-ui -a claude-code
Open on GitHub

What shadcn-ui does

The skill kicks in once your theme is in place: CSS variables, components.json and the cn() utility. Without those it has nothing to build on, so tailwind-theme-builder comes first. From there it walks the install order — buttons, inputs and cards before forms, tables, dialogs and navigation.

It carries a dependency table for the packages shadcn components lean on. Forms need react-hook-form, zod and @hookform/resolvers; toasts need sonner; data tables need @tanstack/react-table; the command palette needs cmdk. Those go in separately with pnpm add.

A chunk of the skill is a gotcha list. An empty string in Select's value breaks the component, so you use a sentinel like __any__ instead. Spreading {...field} from react-hook-form into Input passes null, which the field rejects. Dynamic icon imports from lucide get tree-shaken out of production builds — an explicit map survives. Overriding DialogContent width only works with the same breakpoint prefix as the default. Styling goes through semantic theme tokens, not raw Tailwind colours.

What it helps with

  • add shadcn/ui components in the right dependency order
  • pick the component set for a form, table or nav
  • pull in external deps like zod and @tanstack/react-table
  • wire up a validated form with a toast on submit
  • dodge the usual Select, Input and Dialog bugs

Example prompts for the agent

  • add shadcn/ui components for a contact form
  • build a data table with sorting and pagination using shadcn/ui
  • set up navigation with NavigationMenu on desktop and Sheet on mobile

How to install shadcn-ui

1Skills CLI (Vercel)

npx skills add jezweb/claude-skills --skill shadcn-ui -a claude-code

2Manually: put the files in place

~/.claude/skills/shadcn-ui/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/shadcn-ui/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about shadcn-ui

How do I install shadcn-ui in Claude?

Run npx skills add jezweb/claude-skills --skill shadcn-ui -a claude-code. The skill file lands at ~/.claude/skills/shadcn-ui/SKILL.md.

What does the shadcn-ui skill do?

It guides component installation and configuration in a React project: install order, external dependencies, customisation through semantic theme tokens, and recipes for forms, data tables and navigation.

What has to be set up first?

Theme infrastructure: CSS variables, components.json and the cn() utility. tailwind-theme-builder sets those up, so this skill is meant to run after it.

Source text

SKILL.md · MIT
---
name: shadcn-ui
description: "Install and configure shadcn/ui components for React projects. Guides component selection, installation order, dependency management, customisation with semantic tokens, and common UI recipes (forms, data tables, navigation, modals). Use after tailwind-theme-builder has set up the theme infrastructure, when adding components, building forms, creating data tables, or setting up navigation."
compatibility: claude-code-only
---

# shadcn/ui Components

Add shadcn/ui components to a themed React project. This skill runs AFTER `tailwind-theme-builder` has set up CSS variables, ThemeProvider, and dark mode. It handles component installation, customisation, and combining components into working patterns.

**Prerequisite**: Theme infrastructure must exist (CSS variables, components.json, cn() utility). Use `tailwind-theme-builder` first if not set up.

## Installation Order

Install components in dependency order. Foundation components first, then feature components:

### Foundation (install first)

```bash
pnpm dlx shadcn@latest add button
pnpm dlx shadcn@latest add input label
pnpm dlx shadcn@latest add card
```

### Feature Components (install as needed)

```bash
# Forms
pnpm dlx shadcn@latest add form        # needs: react-hook-form, zod, @hookform/resolvers
pnpm dlx shadcn@latest add textarea select checkbox switch

# Feedback
pnpm dlx shadcn@latest add toast        # needs: sonner
pnpm dlx shadcn@latest add alert badge

# Overlay
pnpm dlx shadcn@latest add dialog sheet popover dropdown-menu

# Data Display
pnpm dlx shadcn@latest add table        # for data tables, also: @tanstack/react-table
pnpm dlx shadcn@latest add tabs separator avatar

# Navigation
pnpm dlx shadcn@latest add navigation-menu command
```

### External Dependencies

| Component | Requires |
|-----------|----------|
| Form | `react-hook-form`, `zod`, `@hookform/resolvers` |
| Toast | `sonner` |
| Data Table | `@tanstack/react-table` |
| Command | `cmdk` |
| Date Picker | `date-fns` (optional) |

Install external deps separately: `pnpm add react-hook-form zod @hookform/resolvers`

## Known Gotchas

These are documented corrections that prevent common bugs:

### Radix Select — No Empty Strings

```tsx
// Don't use empty string values
<SelectItem value="">All</SelectItem>           // BREAKS

// Use sentinel value
<SelectItem value="__any__">All</SelectItem>    // WORKS
const actual = value === "__any__" ? "" : value
```

### React Hook Form — Null Values

```tsx
// Don't spread {...field} — it passes null which Input rejects
<Input
  value={field.value ?? ''}
  onChange={field.onChange}
  onBlur={field.onBlur}
  name={field.name}
  ref={field.ref}
/>
```

### Lucide Icons — Tree-Shaking

```tsx
// Don't use dynamic import — icons get tree-shaken in production
import * as LucideIcons from 'lucide-react'
const Icon = LucideIcons[iconName]  // BREAKS in prod

// Use explicit map
import { Home, Users, Settings, type LucideIcon } from 'lucide-react'
const ICON_MAP: Record<string, LucideIcon> = { Home, Users, Settings }
const Icon = ICON_MAP[iconName]
```

### Dialog Width Override

```tsx
// Default sm:max-w-lg won't be overridden by max-w-6xl
<DialogContent className="max-w-6xl">       // DOESN'T WORK

// Use same breakpoint prefix
<DialogContent className="sm:max-w-6xl">    // WORKS
```

## Customising Components

shadcn components use semantic CSS tokens from your theme. To customise:

### Variant extension

Add custom variants by editing the component file in `src/components/ui/`:

```tsx
// button.tsx — add a "brand" variant
const buttonVariants = cva("...", {
  variants: {
    variant: {
      default: "bg-primary text-primary-foreground",
      brand: "bg-brand text-brand-foreground hover:bg-brand/90",
      // ... existing variants
    },
  },
})
```

### Colour overrides

Use semantic tokens from your theme — never raw Tailwind colours:

```tsx
// Don't use raw colours
<Button className="bg-blue-500">             // WRONG

// Use semantic tokens
<Button className="bg-primary">              // RIGHT
<Card className="bg-card text-card-foreground">  // RIGHT
```

## Workflow

### Step 1: Assess Needs

Determine what UI patterns the project needs:

| Need | Components |
|------|-----------|
| Forms with validation | Form, Input, Label, Select, Textarea, Button, Toast |
| Data display with sorting | Table, Badge, Pagination |
| Admin CRUD interface | Dialog, Form, Table, Button, Toast |
| Marketing/landing page | Card, Button, Badge, Separator |
| Settings/preferences | Tabs, Form, Switch, Select, Toast |
| Navigation | NavigationMenu (desktop), Sheet (mobile), ModeToggle |

### Step 2: Install Components

Install foundation first, then feature components for the identified needs. Use the commands above.

### Step 3: Build Recipes

Combine components into working patterns. See [references/recipes.md](references/recipes.md) for complete working examples:

- **Contact Form** — Form + Input + Textarea + Button + Toast
- **Data Table** — Table + Column sorting + Pagination + Search
- **Modal CRUD** — Dialog + Form + Button
- **Navigation** — Sheet + NavigationMenu + ModeToggle
- **Settings Page** — Tabs + Form + Switch + Select + Toast

### Step 4: Customise

Apply project-specific colours and variants using semantic tokens from the theme.

## Reference Files

| When | Read |
|------|------|
| Choosing components, install commands, props | [references/component-catalogue.md](references/component-catalogue.md) |
| Building complete UI patterns | [references/recipes.md](references/recipes.md) |

© jezweb · MIT · jezweb/claude-skills

Similar skills

Everything for Frontend and UI →

shadcn-ui by other authors comes first.

shadcn-ui official google-labs-code Helps discover, add, and customize shadcn/ui components in React projects. Useful when building interfaces with Tailwind CSS. CX Codex +1 53,400installs shadcn-ui nexu-io This skill helps an agent build structured, accessible UI components with shadcn/ui. Use it while planning an interface with the Stitch design loop. CX Codex +1 2,900installs shadcn-ui giuseppe-trisciuoglio A skill that tells the agent how to install and configure shadcn/ui components: buttons, dialogs, tables, and forms with React Hook Form and Zod. CX Codex +1 22,400installs shadcn-ui existential-birds Teaches your agent how to build shadcn/ui components: Radix primitives, Tailwind, CVA variants and data-slot. CX Codex +1 351installs cursor-ai-react-typescript-shadcn-ui-cursorrules-p PatrickJS A Cursor rule that pushes the agent toward React and TypeScript code written the way shadcn/ui and Tailwind CSS projects expect. ★ 41,011repo stars tailwind-v4-shadcn secondsky Sets up Tailwind CSS v4 with shadcn/ui, Vite, and React. Solves broken CSS variables, theme switching errors, and v4 migration pitfalls. CX Codex +1 8,100installs nextjs-shadcn laguagu A skill that steers the agent through building Next.js interfaces with shadcn/ui, picking typography, theme, backgrounds and motion for the product. CX Codex +1 835installs shadcn shadcn-ui A skill that keeps your agent on the rails with shadcn/ui: adds components, searches registries, fixes markup and builds a design system from your spec. CX Codex +1 123,300installs shadcn-svelte huntabyte A skill for working with shadcn-svelte: adding components, building interfaces, fixing styles, and debugging projects. Use it if you're building UI with shadcn-svelte on Svelte or planning to start. CX Codex +1 6,700installs shadcn-vue unovue Teaches coding agents shadcn-vue architecture, proper CLI runners, FieldGroup form composition, and strict Tailwind semantic token rules. CX Codex +1 5,800installs

From the same set54

tailwind-theme-builder This skill sets up a Tailwind v4 + shadcn/ui theme with dark mode: installs deps, maps CSS variables through @theme inline, wires a theme toggle. CX Codex +1 3,200installs color-palette Turns a single brand hex into a full colour system: an 11-shade scale, semantic tokens, dark mode variants and WCAG contrast checks. CX Codex +1 3,200installs wordpress-elementor Edits Elementor pages and manages templates on WordPress sites via WP-CLI or browser automation. Useful for safe text replacements and layout adjustments. CX Codex +1 2,900installs tanstack-start Scaffolds a full-stack TanStack Start app on Cloudflare Workers from scratch: SSR, file-based routing, D1, auth. Useful when you want a working skeleton without cloning a template. CX Codex +1 2,500installs image-processing Resize, trim whitespace, convert PNG/WebP/JPG, optimise size, build thumbnails and OG cards. Runs on Pillow through the img-process CLI. CX Codex +1 2,400installs favicon-gen Generates complete favicon packages and web manifests from logos, text monograms, or brand colors. Provides clean HTML markup for site headers. CX Codex +1 2,200installs google-apps-script A skill that writes Apps Script code for Google Sheets and Workspace: custom menus, triggers, sidebars, PDF export. CX Codex +1 2,000installs icon-set-generator Draws a set of SVG icons for one project: same grid, same stroke, same corners. Useful when a site needs its own icons instead of a stock library. CX Codex +1 1,900installs

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor