Zum Inhalt springen
Skillpedia
Websites & UI (Frontend)8.7k · #12340

shadcn-ui

Was er macht

Dieser Skill führt durch die Nutzung von shadcn/ui, einer Sammlung fertiger Oberflächenkomponenten, die du in dein Projekt kopierst. Er richtet sich an Frontend-Entwickler, die barrierefreie Komponenten wollen, die sie bearbeiten können.

Wann du ihn nutzt

  • ✓Wenn du einen Button, einen Dialog oder ein Menü aus shadcn/ui zu deiner App hinzufügen willst.
  • ✓Wenn du das Aussehen oder Verhalten einer shadcn-Komponente ändern willst.
  • ✓Wenn du für einen Bildschirm die richtige Komponente auswählen musst.

Link zum Skill

https://github.com/google-labs-code/stitch-skills/blob/main/plugins/stitch-build/skills/shadcn-ui/SKILL.md

Kopiere ihn und füge ihn in deine KI ein (Claude, ChatGPT oder Cursor) mit der Bitte, den Anweisungen zu folgen.

So nutzt du ihn

Am einfachsten: Kopiere die Nachricht und füge sie in deine KI ein. Sie liest den Skill und folgt den Anweisungen.

Fertige Nachricht zum Einfügen

Nutze diesen Skill, um mir zu helfen: https://github.com/google-labs-code/stitch-skills/blob/main/plugins/stitch-build/skills/shadcn-ui/SKILL.md Lies die SKILL.md unter diesem Link und folge ihren Anweisungen für meine Aufgabe.
Soll deine KI Skills wie diesen selbst finden?Installiere den kostenlosen Skillpedia-MCP: eine Zeile, und sie durchsucht vor jeder Aufgabe 15.000+ Skills.In 1 Minute installieren →

Beispielanfrage an deine KI

“Füge einen shadcn-Dialog und eine Datentabelle zu meiner React-App hinzu und gestalte sie passend zu unseren Markenfarben.”

5 neue Skills pro Woche. 1 Minute Lesezeit.

So funktioniert es

Er nutzt die shadcn-Werkzeuge, um die Komponentenliste zu durchsuchen und Beispiele zu zeigen, und fügt dann die gewählten Komponenten in deinen Code ein, damit du sie anpassen kannst.

Technischer Inhalt (originale SKILL.md)

Originaltext des Autors, auf Englisch, direkt von GitHub.

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)

npx 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):

npx shadcn@latest create

For existing projects, initialize configuration:

npx 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:

import { clsx, type ClassValue } from "clsx"
import { twMerge } from "tailwind-merge"

export function cn(...inputs: ClassValue[]) {
  return twMerge(clsx(inputs))
}

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:

@layer base {
  :root {
    --background: 0 0% 100%;
    --foreground: 222.2 84% 4.9%;
    --primary: 221.2 83.2% 53.3%;
    /* ... more variables */
  }
  
  .dark {
    --background: 222.2 84% 4.9%;
    --foreground: 210 40% 98%;
    /* ... dark mode overrides */
  }
}

2. Component Variants

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


Häufige Fragen

Ist shadcn/ui ein Paket, das ich installiere?

Nein, die Komponenten werden in dein Projekt kopiert. Dadurch gehören sie dir, und du kannst sie ändern.

Welches Styling wird genutzt?

Die Komponenten sind mit Tailwind CSS gebaut.

Sind die Komponenten auf eine Version festgelegt?

Nein, der Skill sagt, es gibt keine Versionsbindung, sodass du Teile gezielt aktualisieren kannst.

Details

Originalbeschreibung des Autors

Expert guidance for integrating and building applications with shadcn/ui components, including component discovery, installation, customization, and best practices.

repo: google-labs-code/stitch-skills

Beliebtheit

GitHub-Sterne
8.7k
Platz im Ranking
#12340
Lizenz
Apache-2.0
Aktualisiert
17.8.2026

Ist dieser Skill nützlich?

0

Anmelden um abzustimmen.

Kommentare

  • …

Weitere Skills aus diesem Repository

Ähnliche Skills