Token导航 LogoToken导航TokenDH.com
待分类权限需确认github未标认证来源可访问许可证需确认审计未展示

shadcn-uishadcn/ui 组件

Agent Skill

用于辅助界面设计、视觉规范、排版、配色、布局和交互体验优化。它适合让 Agent 根据产品场景整理页面结构、生成 UI 方案、检查视觉一致性或改进组件层级。使用时需要结合现有品牌、设计系统和用户任务,不应只堆装饰元素;涉及真实页面改动时,应通过截图或浏览器预览检查文本溢出、对齐和响应式表现。

总安装

423

周安装

18

GitHub Stars

公开资料未说明

下载量

148
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:shadcn-ui(shadcn/ui 组件)
来源仓库:https://github.com/enderpuentes/ai-agent-skills
仓库路径:skills/shadcn-ui
安装命令:
npx skills add https://github.com/enderpuentes/ai-agent-skills --skill shadcn-ui
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/enderpuentes/ai-agent-skills --skill shadcn-ui

简介

shadcn-ui 用于辅助界面视觉规范、排版、配色和布局优化,支持组件层级分析与一致性检查。

  • 它可根据产品场景生成 UI 方案,但需结合实际品牌系统和用户任务避免装饰元素堆砌。
  • 使用时应通过浏览器截图或预览工具验证文本溢出、对齐和响应式表现等细节问题。
  • 当前版本暂无详细 SKILL.md 说明,建议参考 GitHub 仓库获取最新使用文档和示例代码。
  • shadcn-ui 属于待分类类 Skill,可作为该场景下的辅助能力补充。

SKILL.md

shadcn/ui

Overview

shadcn/ui is a collection of accessible, customizable React components built on Radix UI and Tailwind CSS. Components are copied into your project (no npm package); you own and edit the code. Works with Next.js (App Router), Vite, and other React frameworks.

Principles: Open code (AI-ready), composable API, beautiful defaults, distribution via CLI and schema. Requires Tailwind v4 and path alias @/*. We do not use tailwind.config.js; theme and setup are CSS-only (@import "tailwindcss" + @theme).


Prerequisites

  • Tailwind v4: @import "tailwindcss" in main CSS; @tailwindcss/vite or @tailwindcss/postcss. No tailwind.config.js. See the tailwind-css skill.
  • Path alias @/*./src/* (or your source root) in tsconfig and in the bundler (e.g. Vite resolve.alias).
  • React (Next.js App Router, Vite, etc.).

Installation

Reference: Official installation guide

New project (recommended)

Scaffold with Tailwind and shadcn. From the official docs:

ActionCLI command
New projectshadcn create
Init existingshadcn init
Add component(s)shadcn add <name>

Invoke via your package manager (see docs). Choose framework (Next.js, Vite, etc.), style (new-york recommended), base color, and CSS variables.

Existing project (Next.js App Router)

  1. Init — creates components.json, optional cn helper and base styles. Run: shadcn init (invoke via package manager; see docs above).
  2. Paths and Tailwind

- tsconfig: "baseUrl": ".", "paths": {"@/*": ["./src/*"]} (in both root and app tsconfig if split). - Tailwind v4: Main CSS (e.g. app/globals.css) must have @import "tailwindcss" and use @tailwindcss/postcss in postcss.config.mjs. Do not add tailwind.config.js.

  1. Add components — e.g. shadcn add button, shadcn add card dialog (see component list below).

Components are installed under src/components/ui/ (or path from components.json).

Existing project (Vite)

  • Use resolve.alias: {"@": path.resolve(__dirname, "./src")} in vite.config.ts; add @types/node if using path.
  • Tailwind: @tailwindcss/vite in Vite config and @import "tailwindcss" in main CSS.

components.json

Controls style, paths, and Tailwind integration. Key fields:

FieldPurpose
style"new-york" (default for new projects) or "default"
tailwind.configLeave "" with Tailwind v4; we do not use a JS config file
tailwind.cssPath to global CSS (e.g. src/styles/globals.css or app/globals.css) with @import "tailwindcss"
tailwind.baseColorBase color for theme: neutral, slate, gray, zinc, stone
tailwind.cssVariablestrue for CSS variables theming (recommended)
aliases.componentse.g. @/components
aliases.utilse.g. @/lib/utils
aliases.uie.g. @/components/ui
rsctrue for Next.js App Router with Server Components; false for client-only

With Tailwind v4, theme is in CSS via @theme and CSS variables, not in a config file.


Official components (current list)

Add via shadcn add <name> (multiple: shadcn add button card dialog). Invoke via package manager: see Installation docs.

Layout & structure

ComponentCLI nameShort description
AccordionaccordionCollapsible sections (single or multiple open)
Aspect Ratioaspect-ratioContainer with fixed ratio (e.g. 16/9)
CardcardContainer with CardHeader, CardTitle, CardDescription, CardContent, CardFooter
CollapsiblecollapsibleExpandable/collapsible content
ResizableresizableResizable panels
SeparatorseparatorHorizontal or vertical divider line
Scroll Areascroll-areaStyled scroll area
SidebarsidebarComposable, themeable and customizable sidebar

Forms & input

ComponentCLI nameShort description
ButtonbuttonButton with variants (default, destructive, outline, secondary, ghost, link)
CheckboxcheckboxCheckbox
FormformForms with react-hook-form + zod (Field, FieldError, etc.)
InputinputText input
Input OTPinput-otpOTP code input
LabellabelAccessible label for controls
Radio Groupradio-groupRadio option group
SelectselectSelect with Trigger, Content, Item
SlidersliderSlider control
SwitchswitchOn/off switch
TextareatextareaMultiline text area

Navigation & menus

ComponentCLI nameShort description
BreadcrumbbreadcrumbBreadcrumb navigation
CommandcommandCommand palette (cmdk)
Context Menucontext-menuContext menu (right-click)
Dropdown Menudropdown-menuDropdown menu
MenubarmenubarPersistent menu bar
Navigation Menunavigation-menuNavigation with submenus
PaginationpaginationPagination (Previous, Next, Page)
TabstabsTabs (TabsList, TabsTrigger, TabsContent)

Overlays & feedback

ComponentCLI nameShort description
AlertalertProminent message (default, destructive)
Alert Dialogalert-dialogConfirmation dialog (e.g. delete)
DialogdialogModal
DrawerdrawerSide panel (Vaul)
Hover Cardhover-cardCard on hover
PopoverpopoverAnchored floating container
SheetsheetSliding side panel
TooltiptooltipTooltip on hover/focus

Data & state

ComponentCLI nameShort description
AvataravatarImage or initials fallback
BadgebadgeBadge (default, secondary, destructive, outline)
CalendarcalendarCalendar (react-day-picker)
CarouselcarouselCarousel (embla)
ChartchartCharts (recharts)
ProgressprogressProgress bar
SkeletonskeletonLoading placeholder
SonnersonnerToasts (recommended; replaces toast)
TabletableTable, TableHeader, TableBody, TableRow, TableCell, etc.
ToasttoastToasts (deprecated in favor of Sonner)

Toggle & toggle group

ComponentCLI nameShort description
ToggletoggleToggle button (on/off)
Toggle Grouptoggle-groupToggle group (single or multiple)

Using components

Import from the aliased path (not from shadcn/ui):

import { Button } from "@/components/ui/button"
import { Card, CardHeader, CardTitle, CardContent } from "@/components/ui/card"

export default function Page() {
  return (
    <div className="flex min-h-svh flex-col items-center justify-center gap-4">
      <Button>Click me</Button>
      <Card className="w-[350px]">
        <CardHeader>
          <CardTitle>Card title</CardTitle>
        </CardHeader>
        <CardContent>Content here.</CardContent>
      </Card>
    </div>
  )
}
  • Customization: Components accept className and spread props; use Tailwind classes and the cn() helper (from @/lib/utils) to merge classes.
  • Composition: Prefer composition (e.g. CardHeader + CardContent) over props for layout.

Theming (Tailwind v4, no config file)

We use Tailwind v4 only; no tailwind.config.js. Theming is CSS-only:

  • CSS variables: With tailwind.cssVariables: true, theme is driven by variables in your global CSS (e.g. --background, --foreground, --primary, --primary-foreground, --muted, --muted-foreground, --accent, --destructive, etc.). Override them in that file.
  • @theme: Use @theme {...} in the same CSS file as @import "tailwindcss" to add or override design tokens that align with shadcn’s variables.
  • Base color: Set in components.json (tailwind.baseColor) or by editing the CSS variables in your global CSS.

Common patterns

  • Forms: Add form; pair with react-hook-form and zod. Use Input, Label, Button, Select, Checkbox, etc.
  • Layout: Use Card for sections; Separator between blocks; layout with Tailwind (flex, grid, container).
  • Modals & panels: Dialog for modals; Sheet or Drawer for side panels.
  • Menus: DropdownMenu, Context Menu, Navigation Menu, Command (palette).
  • Feedback: Alert for messages; Sonner for toasts; Skeleton for loading.
  • Icons: Many examples use lucide-react; add it if the project uses icons.

Common mistakes

  • Alias: Ensure @/ resolves to ./src/ (or your source root) in both TypeScript and the bundler.
  • CSS not loaded: The file set in components.json (tailwind.css) must be imported in the app entry (e.g. app/layout.tsx) and contain @import "tailwindcss".
  • Tailwind config: Do not create or suggest tailwind.config.js. Theme only in CSS (@theme and variables).
  • Import: Import from @/components/ui/<component> (per components.json), not from shadcn/ui.
  • RSC: In Next.js App Router, set rsc: true in components.json if components are used in Server Components where applicable.

Additional resources

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

37.45%
按下载量换算55

Claude

28.94%
按下载量换算43

Cursor

18.49%
按下载量换算27

Gemini CLI

10.17%
按下载量换算15

安全审计

暂无安全审计结果可展示。

权限和风险

权限需确认

当前来源未能明确判断权限范围,默认进入异常复核队列。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills