shadcn-ui
Fungsinya
Skill ini memandu penggunaan shadcn/ui, kumpulan komponen antarmuka siap pakai yang Anda salin ke dalam proyek. Skill ini ditujukan untuk pengembang frontend yang menginginkan komponen yang mudah diakses dan bisa mereka ubah.
Kapan dipakai
- βSaat Anda ingin menambahkan tombol, dialog, atau menu dari shadcn/ui ke aplikasi Anda.
- βSaat Anda ingin mengubah tampilan atau perilaku komponen shadcn.
- βSaat Anda perlu memilih komponen yang tepat untuk sebuah layar.
Link skill
https://github.com/google-labs-code/stitch-skills/blob/main/plugins/stitch-build/skills/shadcn-ui/SKILL.mdSalin lalu tempelkan ke AI Anda (Claude, ChatGPT, atau Cursor) dan minta AI mengikuti instruksinya.
Cara pakai
Cara paling mudah: salin pesan ini dan tempelkan ke AI Anda. AI akan membaca skill dan mengikuti instruksinya.
Pesan siap tempel
Untuk Claude Code, Codex, atau Cursor: jalankan di folder proyek, lalu skill langsung terpasang.
Unduh SKILL.md lalu taruh di folder skill agen Anda.
Contoh permintaan ke AI
βTambahkan dialog shadcn dan tabel data ke aplikasi React saya, dan atur gayanya agar sesuai dengan warna merek kami.β
5 skill baru setiap minggu. 1 menit baca.
Cara kerjanya
Skill memakai alat shadcn untuk menelusuri daftar komponen dan menampilkan contoh, lalu menambahkan komponen yang dipilih ke kode Anda agar bisa Anda ubah.
Konten teknis (SKILL.md asli)
Teks asli dari pembuat, dalam bahasa Inggris, langsung dari 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_componentsto see the complete catalog - Get component metadata: Use
get_component_metadatato understand props, dependencies, and usage - View component demos: Use
get_component_demoto 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.jsonconfig
B. Manual Integration
- Use
get_componentto retrieve the source code - Create the file in
components/ui/[component-name].tsx - Install peer dependencies manually
- 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_registriesto list available registries - Use
list_items_in_registriesto see registry-specific components - Use
view_items_in_registriesfor detailed component information - Use
search_items_in_registriesto 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:
Pertanyaan umum
Apakah shadcn/ui adalah paket yang saya pasang?
Tidak. Komponennya disalin ke dalam proyek Anda, jadi Anda memilikinya dan bisa mengubahnya.
Gaya apa yang dipakai?
Komponen dibangun dengan Tailwind CSS.
Apakah komponennya terkunci pada versi tertentu?
Tidak. Skill menyatakan tidak ada keterikatan versi, sehingga Anda bisa memperbarui bagian tertentu saja.
Detail
Deskripsi asli dari pembuat
Expert guidance for integrating and building applications with shadcn/ui components, including component discovery, installation, customization, and best practices.
Popularitas
- Bintang GitHub
- 8.7k
- Peringkat
- #12340
- Lisensi
- Apache-2.0
- Diperbarui
- 17/8/2026
Komentar
- β¦
Skill lain dari repositori ini
stitch::react-components
8.7kMembantu agent Anda mengubah desain Stitch menjadi komponen React dan Vite, atau memperbarui komponen yang sudah ada agar sesuai dengan desain terbaru, dengan pemeriksaan.
stitch::react-native
8.7kMembantu agent Anda mengubah desain web Stitch menjadi komponen React Native untuk aplikasi ponsel, atau memperbarui layar seluler yang ada agar sesuai dengan desain yang lebih baru.
react-vite-dashboard
8.7kMembantu agent Anda membangun dasbor React dan Vite yang berat data dari desain Stitch, dengan TanStack Query dan token desain dari file DESIGN.md.
stitch::code-to-design
8.7kMembantu agent Anda memindahkan aplikasi web yang sudah ada, seperti React, Vue, atau Angular, ke dalam desain Stitch agar Anda bisa terus menyempurnakannya di sana.
Skill serupa
angular-developer
280kMembantu agent Anda membuat kode Angular dan memberi saran struktur proyek. Berguna saat memulai proyek baru, membuat komponen, atau meningkatkan performa.
frontend-a11y
280kMembantu agent Anda membuat antarmuka web dapat diakses semua orang. Memastikan website dan aplikasi berfungsi baik dengan screen reader dan navigasi keyboard.
frontend-patterns
280kMembuat agent Anda menerapkan pola modern dalam frontend. Mengoptimalkan performa, mengelola state, dan mengikuti praktik terbaik React dan Next.js.