shadcn

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

Updated Aug 15, 2025
One-click install
npx skills add https://github.com/yehezkieldio/topaz --skill shadcn-yehezkieldio
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: shadcn
Source: https://github.com/yehezkieldio/topaz/tree/main/.agents/skills/shadcn
Command: npx skills add https://github.com/yehezkieldio/topaz --skill shadcn-yehezkieldio

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Working with shadcn/ui requires knowing the correct CLI commands, component composition rules, and project-specific configuration (aliases, Tailwind version, icon library, base vs radix primitives). This Skill eliminates guesswork by injecting live project context and enforcing correct usage patterns, preventing common mistakes like wrong imports, invalid composition, and non-semantic styling. ## Core Features & Use Cases - Component Lifecycle Management: Search registries, preview changes with dry-run and diff, add or update components, and smart-merge upstream updates while preserving local modifications. - Enforced Best Practices: Critical rules for forms (FieldGroup/Field), composition (Groups, Titles, Card structure), icons (data-icon, no sizing classes), and styling (semantic tokens, gap-*, cn()). - Preset & Theme Workflows: Initialize projects with named presets or preset codes, apply or switch presets with overwrite/merge/skip strategies, and customize themes via CSS variables. - Use Case: When asked to build a settings form in a Next.js project, the Skill checks the project context, fetches component docs, and generates code using FieldGroup, ToggleGroup, and proper validation states matching the project's base (radix vs base) and icon library. ## Quick Start Ask the assistant to add a shadcn/ui component such as a dialog or build a settings form using shadcn/ui in the current project.

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 the component names, using your project's package runner (npx, pnpm dlx, or bunx). Check installed components first with npx shadcn@latest info, and preview changes with --dry-run or --diff before writing files.

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

Use npx shadcn@latest add <component> --dry-run to see affected files, then --diff <file> to compare upstream changes against your local version. Apply upstream updates per file while preserving your 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, and array defaultValues for components like Select, ToggleGroup, Slider, and Accordion.

How do I apply or switch a shadcn preset code?▼

Pass the preset code directly to npx shadcn@latest apply <code> for existing projects or npx shadcn@latest init --preset <code> when initializing. Never decode preset codes manually; use preset decode, preset url, or preset resolve commands to inspect them.

Why should I avoid space-y and raw color classes in shadcn/ui?▼

shadcn/ui components rely on semantic CSS variable tokens like bg-primary and text-muted-foreground that adapt to light and dark themes automatically. Raw colors break theming, and space-y utilities cause spacing issues; use flex with gap-* instead.

Can I use third-party registries with the shadcn CLI?▼

Yes, the CLI supports namespaced registries like @magicui, public GitHub sources as owner/repo/item, and direct URLs. After adding third-party components, verify the added files since import aliases and icon libraries may not match your project configuration.