shadcn-ui
ما الذي تفعله
ترشد هذه المهارة إلى استخدام shadcn/ui، وهي مجموعة مكونات واجهة جاهزة تنسخها إلى مشروعك. وهي مناسبة لمطوري الواجهات الأمامية الذين يريدون مكونات يسهل الوصول إليها ويمكنهم تعديلها.
متى تستخدمها
- ✓عندما تريد إضافة زر أو نافذة حوار أو قائمة من shadcn/ui إلى تطبيقك.
- ✓عندما تريد تغيير شكل مكون من shadcn أو سلوكه.
- ✓عندما تحتاج إلى اختيار المكون المناسب لشاشة معينة.
رابط المهارة
https://github.com/google-labs-code/stitch-skills/blob/main/plugins/stitch-build/skills/shadcn-ui/SKILL.mdانسخه والصقه في الذكاء الاصطناعي الذي تستخدمه (Claude أو ChatGPT أو Cursor) واطلب منه اتباع التعليمات.
طريقة الاستخدام
أسهل طريقة: انسخ الرسالة والصقها في الذكاء الاصطناعي الذي تستخدمه. سيقرأ المهارة وينفّذ تعليماتها.
رسالة جاهزة للصق
لـ Claude Code أو Codex أو Cursor: شغّله داخل مجلد مشروعك وستُثبَّت المهارة.
نزّل ملف SKILL.md وضعه في مجلد مهارات وكيلك.
مثال على ما تطلبه من الذكاء الاصطناعي
“أضف نافذة حوار من shadcn وجدول بيانات إلى تطبيق React الخاص بي، وصمّمهما بألوان علامتنا التجارية.”
5 مهارات جديدة كل أسبوع. قراءة في دقيقة واحدة.
كيف تعمل
تستخدم المهارة أدوات shadcn لتصفح قائمة المكونات وعرض أمثلة، ثم تضيف المكونات المختارة إلى شيفرتك لتعدّلها.
المحتوى التقني (ملف SKILL.md الأصلي)
النص الأصلي من المؤلف، مباشرة من 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:
الأسئلة الشائعة
هل shadcn/ui حزمة أثبتها؟
لا، تُنسخ المكونات إلى مشروعك، فتمتلكها وتستطيع تعديلها.
ما التنسيق الذي تستخدمه؟
بنيت المكونات باستخدام Tailwind CSS.
هل المكونات مقيدة بإصدار معين؟
لا، تنص المهارة على عدم وجود قيد إصدار، فيمكنك تحديث الأجزاء بشكل انتقائي.
التفاصيل
الوصف الأصلي من المؤلف
Expert guidance for integrating and building applications with shadcn/ui components, including component discovery, installation, customization, and best practices.
الشعبية
- نجوم GitHub
- 8.7k
- الترتيب
- #12340
- الترخيص
- Apache-2.0
- آخر تحديث
- 17/8/2026
التعليقات
- …
المزيد من المهارات من هذا المستودع
stitch::react-components
8.7kيساعد وكيلك على تحويل تصاميم Stitch إلى مكونات React وVite، أو تحديث المكونات الموجودة لتطابق أحدث تصميم، مع فحوص للجودة.
stitch::react-native
8.7kيساعد وكيلك على تحويل تصاميم Stitch للويب إلى مكونات React Native لتطبيقات الهاتف، أو تحديث شاشات الجوال الموجودة لتطابق تصميماً أحدث.
react-vite-dashboard
8.7kيساعد وكيلك على بناء لوحات تحكم React وVite كثيفة البيانات من تصاميم Stitch، مع TanStack Query ورموز تصميم من ملف DESIGN.md.
stitch::code-to-design
8.7kيساعد وكيلك على نقل تطبيق ويب موجود، مثل React أو Vue أو Angular، إلى تصميم في Stitch حتى تكمل تحسينه هناك.
مهارات مشابهة
angular-developer
280kيساعد وكيلك على كتابة شيفرة Angular وتقديم نصائح لبنية المشروع، ويفيد في بدء المشاريع الجديدة وإنشاء المكونات وتحسين الأداء وإمكانية الوصول.
frontend-a11y
280kيساعد وكيلك على جعل واجهات الويب متاحة للجميع، فيضمن أن المواقع والتطبيقات تعمل جيدًا مع قارئات الشاشة والتنقل بلوحة المفاتيح.
frontend-patterns
280kيطبّق وكيلك أنماط تطوير الواجهات الحديثة، فيحسّن الأداء ويدير الحالة ويتبع أفضل الممارسات في React وNext.js.