shadcn

Manages shadcn/ui components via CLI for adding, searching, styling, and composing React UI.

Updated Mar 20, 2026
One-click install
npx skills add https://github.com/designbycode/uidesign --skill shadcn-designbycode
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: shadcn
Source: https://github.com/designbycode/uidesign/tree/main/.openhands/skills/shadcn
Command: npx skills add https://github.com/designbycode/uidesign --skill shadcn-designbycode

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Working with shadcn/ui involves many project-specific details — aliases, Tailwind versions, icon libraries, base vs radix primitives, and registry sources — that are easy to get wrong. This Skill injects the live project context and enforces correct component composition, styling, and CLI usage so generated UI code matches the project's actual configuration. ## Core Features & Use Cases - Component lifecycle management: Search registries, preview with --dry-run/--diff, add components, and smart-merge upstream updates while preserving local changes. - Enforced UI rules: Critical rules for forms (FieldGroup/Field), styling (semantic tokens, gap-, size-), icons (data-icon), and composition (Groups, Titles, AvatarFallback) with Incorrect/Correct examples. - Project-aware guidance: Reads npx shadcn@latest info output to adapt imports, icon libraries, RSC directives, and Tailwind v3/v4 theming to the project. - Use Case: Ask to build a settings form, and the Skill produces code using FieldGroup, ToggleGroup, data-invalid validation, and the project's configured icon library instead of generic markup. ## Quick Start Ask the assistant to add a shadcn/ui component like a dialog or build a settings form in your project, and it will use the shadcn CLI with the correct project context.

Frequently Asked Questions about shadcn

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add shadcn/ui components to my project?

Run npx shadcn@latest add followed by component names, such as npx shadcn@latest add button card dialog. Use the package runner matching your project (npx, pnpm dlx, or bunx), and preview changes first with --dry-run or --diff before writing files.

How do I update shadcn components without losing my local changes?

Use the smart merge workflow: run npx shadcn@latest add <component> --dry-run to see affected files, then --diff <file> per file to compare upstream changes. Apply upstream updates manually where you have local modifications, and never use --overwrite without explicit approval.

What is the difference between base and radix in shadcn/ui?

The base field in components.json determines the primitive library, which changes component APIs. Radix uses asChild and type="single"/"multiple" props, while base uses render props, multiple booleans, items props on Select, and scalar Slider values. Check the base field via npx shadcn@latest info.

Does shadcn/ui work with Tailwind CSS v4?

Yes, shadcn/ui supports both Tailwind v3 and v4. Check the tailwindVersion field from npx shadcn@latest info: v4 registers custom colors via @theme inline blocks in the global CSS file, while v3 uses tailwind.config.js.

Why should I avoid space-y-* and raw colors in shadcn/ui code?

The skill's styling rules require gap-* with flex layouts instead of space-x-*/space-y-*, and semantic tokens like bg-primary or text-muted-foreground instead of raw colors like bg-blue-500. Semantic tokens handle dark mode automatically through CSS variables.

How do I switch shadcn presets in an existing project?

Run npx shadcn@latest init --preset <code> --force, choosing reinstall (overwrite all components), merge (smart-merge each installed component), or skip (update only config and CSS). Preset codes are opaque base62 strings passed directly to the CLI without manual decoding.