KS
Killer-Skills

shadcn-ui — how to use shadcn-ui how to use shadcn-ui, shadcn-ui vs Radix UI, shadcn-ui setup guide, what is shadcn-ui, shadcn-ui alternative, shadcn-ui install with Tailwind CSS, customizing shadcn-ui components, shadcn-ui and Base UI integration, shadcn-ui accessibility features

Verified
v1.0.0
GitHub

About this Skill

Perfect for Frontend Agents needing accessible and customizable UI components built with Radix UI and Tailwind CSS. shadcn-ui is a collection of beautifully designed, accessible, and customizable components built with Radix UI or Base UI and Tailwind CSS.

Features

Provides reusable components built with Radix UI and Tailwind CSS
Supports customization following best practices
Allows for full ownership of components copied into projects
Utilizes Base UI for additional component functionality
Integrates with Tailwind CSS for styling and layout control
Enables accessible application development

# Core Topics

google-labs-code google-labs-code
[0]
[0]
Updated: 3/6/2026

Quality Score

Top 5%
82
Excellent
Based on code quality & docs
Installation
SYS Universal Install (Auto-Detect)
Cursor IDE Windsurf IDE VS Code IDE
> npx killer-skills add google-labs-code/stitch-skills/shadcn-ui

Agent Capability Analysis

The shadcn-ui MCP Server by google-labs-code is an open-source Categories.community integration for Claude and other AI agents, enabling seamless task automation and capability expansion. Optimized for how to use shadcn-ui, shadcn-ui vs Radix UI, shadcn-ui setup guide.

Ideal Agent Persona

Perfect for Frontend Agents needing accessible and customizable UI components built with Radix UI and Tailwind CSS.

Core Value

Empowers agents to build accessible applications with customizable components, utilizing Radix UI and Tailwind CSS for seamless integration and styling, while following best practices for component discovery and customization.

Capabilities Granted for shadcn-ui MCP Server

Integrating accessible UI components into web applications
Customizing shadcn/ui components for tailored user experiences
Building reusable component libraries with Radix UI and Tailwind CSS

! Prerequisites & Limits

  • Requires knowledge of Radix UI and Tailwind CSS
  • Not a traditional component library, but rather a collection of reusable components
Project
SKILL.md
8.7 KB
.cursorrules
1.2 KB
package.json
240 B
Ready
UTF-8

# Tags

[No tags]
SKILL.md
Readonly

shadcn/ui Component Integration

You are a frontend engineer specialized in building applications with shadcn/ui—a collection of beautifully designed, accessible, and customizable components built with Radix UI or Base UI and Tailwind CSS. You help developers discover, integrate, and customize components following best practices.

Core Principles

shadcn/ui is not a component library—it's a collection of reusable components that you copy into your project. This gives you:

  • Full ownership: Components live in your codebase, not node_modules
  • Complete customization: Modify styling, behavior, and structure freely, including choosing between Radix UI or Base UI primitives
  • No version lock-in: Update components selectively at your own pace
  • Zero runtime overhead: No library bundle, just the code you need

Component Discovery and Installation

1. Browse Available Components

Use the shadcn MCP tools to explore the component catalog and Registry Directory:

  • List all components: Use list_components to see the complete catalog
  • Get component metadata: Use get_component_metadata to understand props, dependencies, and usage
  • View component demos: Use get_component_demo to see implementation examples

2. Component Installation

There are two approaches to adding components:

A. Direct Installation (Recommended)

bash
1npx shadcn@latest add [component-name]

This command:

  • Downloads the component source code (adapting to your config: Radix vs Base UI)
  • Installs required dependencies
  • Places files in components/ui/
  • Updates your components.json config

B. Manual Integration

  1. Use get_component to retrieve the source code
  2. Create the file in components/ui/[component-name].tsx
  3. Install peer dependencies manually
  4. Adjust imports if needed

3. Registry and Custom Registries

If working with a custom registry (defined in components.json) or exploring the Registry Directory:

  • Use get_project_registries to list available registries
  • Use list_items_in_registries to see registry-specific components
  • Use view_items_in_registries for detailed component information
  • Use search_items_in_registries to find specific components

Project Setup

Initial Configuration

For new projects, use the create command to customize everything (style, fonts, component library):

bash
1npx shadcn@latest create

For existing projects, initialize configuration:

bash
1npx shadcn@latest init

This creates components.json with your configuration:

  • style: default, new-york (classic) OR choose new visual styles like Vega, Nova, Maia, Lyra, Mira
  • baseColor: slate, gray, zinc, neutral, stone
  • cssVariables: true/false for CSS variable usage
  • tailwind config: paths to Tailwind files
  • aliases: import path shortcuts
  • rsc: Use React Server Components (yes/no)
  • rtl: Enable RTL support (optional)

Required Dependencies

shadcn/ui components require:

  • React (18+)
  • Tailwind CSS (3.0+)
  • Primitives: Radix UI OR Base UI (depending on your choice)
  • class-variance-authority (for variant styling)
  • clsx and tailwind-merge (for class composition)

Component Architecture

File Structure

src/
├── components/
│   ├── ui/              # shadcn components
│   │   ├── button.tsx
│   │   ├── card.tsx
│   │   └── dialog.tsx
│   └── [custom]/        # your composed components
│       └── user-card.tsx
├── lib/
│   └── utils.ts         # cn() utility
└── app/
    └── page.tsx

The cn() Utility

All shadcn components use the cn() helper for class merging:

typescript
1import { clsx, type ClassValue } from "clsx" 2import { twMerge } from "tailwind-merge" 3 4export function cn(...inputs: ClassValue[]) { 5 return twMerge(clsx(inputs)) 6}

This allows you to:

  • Override default styles without conflicts
  • Conditionally apply classes
  • Merge Tailwind classes intelligently

Customization Best Practices

1. Theme Customization

Edit your Tailwind config and CSS variables in app/globals.css:

css
1@layer base { 2 :root { 3 --background: 0 0% 100%; 4 --foreground: 222.2 84% 4.9%; 5 --primary: 221.2 83.2% 53.3%; 6 /* ... more variables */ 7 } 8 9 .dark { 10 --background: 222.2 84% 4.9%; 11 --foreground: 210 40% 98%; 12 /* ... dark mode overrides */ 13 } 14}

2. Component Variants

Use class-variance-authority (cva) for variant logic:

typescript
1import { cva } from "class-variance-authority" 2 3const buttonVariants = cva( 4 "inline-flex items-center justify-center rounded-md", 5 { 6 variants: { 7 variant: { 8 default: "bg-primary text-primary-foreground", 9 outline: "border border-input", 10 }, 11 size: { 12 default: "h-10 px-4 py-2", 13 sm: "h-9 rounded-md px-3", 14 }, 15 }, 16 defaultVariants: { 17 variant: "default", 18 size: "default", 19 }, 20 } 21)

3. Extending Components

Create wrapper components in components/ (not components/ui/):

typescript
1// components/custom-button.tsx 2import { Button } from "@/components/ui/button" 3import { Loader2 } from "lucide-react" 4 5export function LoadingButton({ 6 loading, 7 children, 8 ...props 9}: ButtonProps & { loading?: boolean }) { 10 return ( 11 <Button disabled={loading} {...props}> 12 {loading && <Loader2 className="mr-2 h-4 w-4 animate-spin" />} 13 {children} 14 </Button> 15 ) 16}

Blocks and Complex Components

shadcn/ui provides complete UI blocks (authentication forms, dashboards, etc.):

  1. List available blocks: Use list_blocks with optional category filter
  2. Get block source: Use get_block with the block name
  3. Install blocks: Many blocks include multiple component files

Blocks are organized by category:

  • calendar: Calendar interfaces
  • dashboard: Dashboard layouts
  • login: Authentication flows
  • sidebar: Navigation sidebars
  • products: E-commerce components

Accessibility

All shadcn/ui components are built on Radix UI primitives, ensuring:

  • Keyboard navigation: Full keyboard support out of the box
  • Screen reader support: Proper ARIA attributes
  • Focus management: Logical focus flow
  • Disabled states: Proper disabled and aria-disabled handling

When customizing, maintain accessibility:

  • Keep ARIA attributes
  • Preserve keyboard handlers
  • Test with screen readers
  • Maintain focus indicators

Common Patterns

Form Building

typescript
1import { Button } from "@/components/ui/button" 2import { Input } from "@/components/ui/input" 3import { Label } from "@/components/ui/label" 4 5// Use with react-hook-form for validation 6import { useForm } from "react-hook-form"

Dialog/Modal Patterns

typescript
1import { 2 Dialog, 3 DialogContent, 4 DialogDescription, 5 DialogHeader, 6 DialogTitle, 7 DialogTrigger, 8} from "@/components/ui/dialog"

Data Display

typescript
1import { 2 Table, 3 TableBody, 4 TableCell, 5 TableHead, 6 TableHeader, 7 TableRow, 8} from "@/components/ui/table"

Troubleshooting

Import Errors

  • Check components.json for correct alias configuration
  • Verify tsconfig.json includes the @ path alias:
    json
    1{ 2 "compilerOptions": { 3 "paths": { 4 "@/*": ["./src/*"] 5 } 6 } 7}

Style Conflicts

  • Ensure Tailwind CSS is properly configured
  • Check that globals.css is imported in your root layout
  • Verify CSS variable names match between components and theme

Missing Dependencies

  • Run component installation via CLI to auto-install deps
  • Manually check package.json for required Radix UI packages
  • Use get_component_metadata to see dependency lists

Version Compatibility

  • shadcn/ui v4 requires React 18+ and Next.js 13+ (if using Next.js)
  • Some components require specific Radix UI versions
  • Check documentation for breaking changes between versions

Validation and Quality

Before committing components:

  1. Type check: Run tsc --noEmit to verify TypeScript
  2. Lint: Run your linter to catch style issues
  3. Test accessibility: Use tools like axe DevTools
  4. Visual QA: Test in light and dark modes
  5. Responsive check: Verify behavior at different breakpoints

Resources

Refer to the following resource files for detailed guidance:

  • resources/setup-guide.md - Step-by-step project initialization
  • resources/component-catalog.md - Complete component reference
  • resources/customization-guide.md - Theming and variant patterns
  • resources/migration-guide.md - Upgrading from other UI libraries

Examples

See the examples/ directory for:

  • Complete component implementations
  • Form patterns with validation
  • Dashboard layouts
  • Authentication flows
  • Data table implementations

Related Skills

Looking for an alternative to shadcn-ui or building a Categories.community AI Agent? Explore these related open-source MCP Servers.

View All

widget-generator

Logo of f
f

widget-generator is an open-source AI agent skill for creating widget plugins that are injected into prompt feeds on prompts.chat. It supports two rendering modes: standard prompt widgets using default PromptCard styling and custom render widgets built as full React components.

149.6k
0
Design

chat-sdk

Logo of lobehub
lobehub

chat-sdk is a unified TypeScript SDK for building chat bots across multiple platforms, providing a single interface for deploying bot logic.

73.0k
0
Communication

zustand

Logo of lobehub
lobehub

The ultimate space for work and life — to find, build, and collaborate with agent teammates that grow with you. We are taking agent harness to the next level — enabling multi-agent collaboration, effortless agent team design, and introducing agents as the unit of work interaction.

72.8k
0
Communication

data-fetching

Logo of lobehub
lobehub

The ultimate space for work and life — to find, build, and collaborate with agent teammates that grow with you. We are taking agent harness to the next level — enabling multi-agent collaboration, effortless agent team design, and introducing agents as the unit of work interaction.

72.8k
0
Communication