shadcn-ui

Implements shadcn/ui component patterns with Radix primitives, CVA variants, and Tailwind styling.

2|Updated May 25, 2026
One-click install
npx skills add https://github.com/edheltzel/Do-Skills --skill shadcn-ui-edheltzel
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: shadcn-ui
Source: https://github.com/edheltzel/Do-Skills/tree/main/skills/engineering/frontend/do-review-frontend/references/shadcn-ui
Command: npx skills add https://github.com/edheltzel/Do-Skills --skill shadcn-ui-edheltzel

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires class-variance-authority, clsx, tailwind-merge, @radix-ui/react-slot, @radix-ui/react-dialog, @radix-ui/react-label, and includes references (resource) components.

What problem does it solve? Building consistent, accessible React UI components with shadcn/ui requires knowing many conventions—CVA variants, the cn() utility, asChild polymorphism, data-slot targeting, and compound component structure. This Skill consolidates those patterns so components are built correctly the first time. ## Core Features & Use Cases - Component Implementation Patterns: Complete typed implementations of Button, Card, Badge, Input, Label, Textarea, and Dialog using Radix primitives and Tailwind. - CVA Variant Authoring: Guidance on variant dimensions, compound variants, defaultVariants, and VariantProps type extraction. - Architectural Patterns: Compound components, asChild/Slot polymorphism, controlled vs uncontrolled state, Context providers, data-slot CSS targeting, and has() selectors. - Use Case: When asked to build a Dialog or restyle a Button with new variants, the Skill supplies the canonical shadcn/ui structure, accessibility states, and CLI commands (npx shadcn@latest add) to do it idiomatically. ## Quick Start Ask the agent to create a shadcn/ui Button component with outline and ghost variants using CVA and Tailwind.

Frequently Asked Questions about shadcn-ui

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

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

Run npx shadcn@latest init to create components.json and set up Tailwind, then use npx shadcn@latest add button to install individual components. The old shadcn-ui package name is deprecated; use shadcn instead.

How do I create variant-based styles with CVA in Tailwind?▼

Define variants with cva() by specifying base classes, variant dimensions like variant and size, and defaultVariants. Extract types with VariantProps<typeof variants> and merge user classes through the cn() utility.

What is the asChild prop in shadcn/ui components?▼

The asChild prop uses Radix UI's Slot component to render the component as its child element instead of the default tag. This lets a Button render as an anchor or Next.js Link while keeping button styling and behavior.

When should I use compound components versus a single component with props?▼

Use compound components when UI has multiple semantic parts, optional sections, or parts needing independent styling, like Card with CardHeader and CardFooter. Use a single component for simple wrappers that only render children.

What are data-slot attributes used for in shadcn/ui?▼

Every component includes a data-slot attribute enabling CSS and Tailwind targeting, such as [&_[data-slot=button]]:shadow-lg. Combined with has() selectors, parents can adjust layouts when specific child slots are present.

Does the has() selector work in all browsers for conditional styling?▼

The :has() selector works in Chrome 105+, Safari 15.4+, and Firefox 121+. For older browsers, provide fallback base classes alongside the has() conditional classes so layouts degrade gracefully.