shadcn-guide
БесплатноБез исполняемых скриптовНе проверенGuide for shadcn/ui — the open-code component system for React. Use when user asks to install, configure, theme, or use shadcn/ui components, set up dark…
от vcode-sh★ 19 звёзд на GitHubОб этом скилле
shadcn/ui Guide
Purpose
shadcn/ui is not a component library — it's a system to build your own component library. Components are copied into your project as open source code you fully own and control. Two primitive variants are available: Base UI (by MUI) and Radix UI (default).
Core Principles: Open Code, Composition, Distribution (schema + CLI), Beautiful Defaults, AI-Ready.
Upstream updates: shadcn/ui follows a headless component architecture. The core receives fixes by updating dependencies (e.g. radix-ui, input-otp). The topmost layer (closest to your design system) stays open for modification and is not coupled with the library implementation.
Do NOT use this guide for Chakra UI, Material UI (MUI), Ant Design, or vanilla Tailwind CSS without shadcn/ui context — those have different installation, theming, and component APIs.
Quick Start
# Initialize a new project (or add to existing)
npx shadcn@latest init
# Add components
npx shadcn@latest add button dialog card
# Add all components
npx shadcn@latest add --all
# Interactive setup with custom themes
npx shadcn@latest create
CLI Commands
| Command | Purpose | Example |
|---|---|---|
create |
Interactive project scaffolding | npx shadcn@latest create |
init |
Initialize project config | npx shadcn@latest init |
add |
Add components to project | npx shadcn@latest add button card |
add --all |
Add all components | npx shadcn@latest add --all |
view |
View registry items | npx shadcn@latest view @acme/button |
search / list |
Search/list registries | npx shadcn@latest search @v0 -q "button" |
build |
Build registry JSON | npx shadcn@latest build |
migrate |
Run migrations | npx shadcn@latest migrate rtl |
mcp |
Start MCP server | npx shadcn@latest mcp init --client claude |
Key CLI flags: -y (skip prompts), -o (overwrite), -a (all), -c <cwd> (working directory), -s (silent). See references/configuration.md for full CLI command details.
Configuration (components.json)
Located at project root. Created by init. Schema: https://ui.shadcn.com/schema.json
{
"$schema": "https://ui.shadcn.com/schema.json",
"style": "new-york",
"rsc": true,
"tsx": true,
"tailwind": {
"config": "",
"css": "app/globals.css",
"baseColor": "neutral",
"cssVariables": true
},
"iconLibrary": "lucide",
"aliases": {
"components": "@/components",
"utils": "@/lib/utils",
"ui": "@/components/ui",
"lib": "@/lib",
"hooks": "@/hooks"
}
}
Immutable after init: style, baseColor, cssVariables. Use new-york style (default is deprecated).
Theming (CSS Variables)
Colors use OKLCH format. Convention: --[role] for background, --[role]-foreground for text.
:root {
--background: oklch(1 0 0);
--foreground: oklch(0.145 0 0);
--primary: oklch(0.205 0 0);
--primary-foreground: oklch(0.985 0 0);
--secondary: oklch(0.97 0 0);
--muted: oklch(0.97 0 0);
--muted-foreground: oklch(0.556 0 0);
--accent: oklch(0.97 0 0);
--destructive: oklch(0.577 0.245 27.325);
--border: oklch(0.922 0 0);
--input: oklch(0.922 0 0);
--ring: oklch(0.708 0 0);
--radius: 0.625rem;
}
Usage: <div className="bg-primary text-primary-foreground" />
Adding custom colors:
:root { --warning: oklch(0.84 0.16 84); --warning-foreground: oklch(0.28 0.07 46); }
.dark { --warning: oklch(0.41 0.11 46); --warning-foreground: oklch(0.99 0.02 95); }
@theme inline { --color-warning: var(--warning); --color-warning-foreground: var(--warning-foreground); }
Base colors: neutral, stone, zinc, gray, slate.
Component Pattern
All components follow the same pattern:
npx shadcn@latest add [component-name]
import { Component } from "@/components/ui/component"
export function Example() {
return <Component>Content</Component>
}
58 components available in both Base UI and Radix variants. See references/components-*.md (6 files by category).
Most-used components: Button, Card, Dialog, Input, Select, Table, Tabs, Form/Field, Sidebar, Sheet, Dropdown Menu, Command, Toast (Sonner), Badge, Avatar.
Essential Utility
// lib/utils.ts — created by init
import { clsx, type ClassValue } from "clsx"
import { twMerge } from "tailwind-merge"
export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs))
}
JavaScript Support (TypeScript Opt-Out)
Set "tsx": false in components.json to generate .jsx files instead of .tsx:
{ "tsx": false }
Configure import aliases in jsconfig.json:
{
"compilerOptions": {
"paths": { "@/*": ["./*"] }
}
}
v0 Integration
Every shadcn/ui component is editable on v0.dev — AI-powered customization in natural language, then paste into your app. Requires a free Vercel account.
**Open in v0 for registries
Установить shadcn-guide в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл shadcn-guide?
Guide for shadcn/ui — the open-code component system for React. Use when user asks to install, configure, theme, or use shadcn/ui components, set up dark mode, create forms, build a registry, configure MCP, or set up RTL/monorepo/JavaScript mode. Covers 58+ components (Base UI and Radix variants), CLI commands, components.json, CSS variable theming, framework installation (Next.js, Vite, Astro, Remix, Laravel, Gatsby, TanStack), registry system, and form patterns. Do NOT use for Chakra UI, Material UI, Ant Design, or vanilla Tailwind without shadcn context.
Как установить скилл shadcn-guide?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл shadcn-guide запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic