ui
Load for ANY frontend / UI / styling work — shadcn/ui components, react-hook-form + zod forms, multi-step wizards, responsive app shells (desktop sidebar ↔ mobile hamburger drawer), React Router routing & URL-synced lists (filter/search/sort/pagination), Lucide icons, Tailwind v4 theming, accessibility (focus, ARIA, prefers-reduced-motion, hydration), and styling / composition / forms / icons / patterns rules. Use whenever building or modifying any user interface, form, modal, drawer, bottom sheet, menu, searchable selector, toast notification, icon, status indicator, card, tabs, badge, toggle, theme color, dark-mode toggle, or any styled / interactive element.
- License 许可
- AGPL-3.0
- 最近更新
- 2026-11-05
- Stars
- ★ 43
- Forks
- 9
01 前言 Front Matter
- name
- ui
- description
- Load for ANY frontend / UI / styling work — shadcn/ui components, react-hook-form + zod forms, multi-step wizards, responsive app shells (desktop sidebar ↔ mobile hamburger drawer), React Router routing & URL-synced lists (filter/search/sort/pagination), Lucide icons, Tailwind v4 theming, accessibility (focus, ARIA, prefers-reduced-motion, hydration), and styling / composition / forms / icons / patterns rules. Use whenever building or modifying any user interface, form, modal, drawer, bottom sheet, menu, searchable selector, toast notification, icon, status indicator, card, tabs, badge, toggle, theme color, dark-mode toggle, or any styled / interactive element.
02 资源文件 8
- 参考文档rules/accessibility.md5.5 KB
- 参考文档rules/composition.md6.3 KB
- 参考文档rules/forms.md15.5 KB
- 参考文档rules/icons.md3.5 KB
- 参考文档rules/navigation.md10.8 KB
- 参考文档rules/patterns.md14.6 KB
- 参考文档rules/styling.md4.5 KB
- 参考文档rules/theming.md6.1 KB
03 SKILL.md 正文
shadcn/ui
Components live in frontend/src/components/ui/. They're plain TSX — modify them directly. Built on Radix UI primitives (function components, no forwardRef, data-slot attributes, Tailwind v4).
Pre-built components (import from @/components/ui/<name>)
Layout & content
card—Card,CardHeader,CardTitle,CardDescription,CardContent,CardFooterseparator— horizontal/vertical dividerskeleton— loading placeholder (animated bg)tabs—Tabs,TabsList,TabsTrigger,TabsContentavatar—Avatar,AvatarImage,AvatarFallback
Input
button— variants: default, destructive, outline, secondary, ghost, link; sizes: default, sm, lg, icon. SupportsasChildinput— text inputtextarea— multi-line inputlabel— accessible form label (usehtmlFor)checkbox—Checkboxwith check iconswitch— toggle on/offselect—Select,SelectTrigger,SelectValue,SelectContent,SelectItem,SelectGroup,SelectLabel,SelectSeparatorbadge— variants: default, secondary, destructive, outline
Overlays
dialog— modal —Dialog,DialogTrigger,DialogContent,DialogHeader,DialogTitle,DialogDescription,DialogFooter,DialogClosealert-dialog— confirmation modal — same shape but withAlertDialogAction/AlertDialogCancelsheet— Radix-backed side panel (desktop-first) —Sheet,SheetTrigger,SheetContent(side="left|right|top|bottom"),SheetHeader,SheetTitledrawer— vaul-backed bottom sheet (mobile-first, swipeable) —Drawer,DrawerTrigger,DrawerContent,DrawerHeader,DrawerTitle,DrawerDescription,DrawerFooter,DrawerClose(supportsdirection="top|right|bottom|left")popover—Popover,PopoverTrigger,PopoverContenttooltip—Tooltip,TooltipTrigger,TooltipContent,TooltipProviderdropdown-menu—DropdownMenu,DropdownMenuTrigger,DropdownMenuContent,DropdownMenuItem,DropdownMenuCheckboxItem,DropdownMenuRadioItem,DropdownMenuLabel,DropdownMenuSeparator,DropdownMenuSub*,DropdownMenuShortcutcommand— searchable list (cmdk) —Command,CommandDialog,CommandInput,CommandList,CommandEmpty,CommandGroup,CommandItem,CommandSeparator,CommandShortcut
Feedback
alert—Alert,AlertTitle,AlertDescription(variants: default, destructive)sonner— toast root —Toaster. Mount once at app root; calltoast()from sonner anywhere.
App shell & responsive navigation (multi-page apps)
An app with two or more nav destinations uses one responsive App Shell: a single component where the desktop sidebar and the mobile hamburger→Drawer render the same nav list — sidebar hidden md:block, hamburger md:hidden, so exactly one is visible at any width. A single-page app needs no nav chrome; skip the shell.
Build the sidebar and its mobile drawer together — never apart. Hiding a sidebar on mobile (hidden md:block) without also rendering a hamburger that opens the same nav leaves mobile users with no navigation at all — the most common mobile bug in generated apps. The desktop rail and the mobile menu are one unit, fed by one nav array, so they can't drift and the menu can't be forgotten.
Full recipe: rules/patterns.md → "Responsive App Shell". Before telling the user a multi-page app is done, open agent-browser at 375px and confirm the hamburger shows and every destination opens from the drawer.
Rules and patterns
Detail lives alongside this file — load the relevant page when generating non-trivial code:
- rules/styling.md — semantic colors, no
space-x/y,size-*, no manualz-index,cn(), built-in variants first, typography niceties (curly quotes,…,tabular-nums,text-balance), content handling (truncate,min-w-0, empty states), hover contrast. - rules/composition.md — items inside Groups, Dialog/Sheet/Drawer titles, Avatar fallback,
Buttonhas noisPending, choosing overlay components, URL-as-state, destructive actions need confirm or undo,asChild. - rules/icons.md —
data-iconon Button, no sizing classes inside components, Lucide catalog,aria-labelon icon-only buttons,aria-hiddenon decorative icons, icons as component values. - rules/forms.md —
Label+htmlFor,aria-invalid, control selection, gap-based stacking,type/inputmode/autocomplete, placeholder pattern, focus-first-error on submit, react-hook-form + zod patterns, controlled fields, mutation+toast flow, dynamic field arrays, edit forms, multi-step wizards. - rules/theming.md — Tailwind v4 OKLCH variables, semantic token reference, brand customization, border radius, dark mode (
next-themes),tw-animate-cssanimations, chart colors. - rules/accessibility.md — semantic HTML before ARIA, focus states (
:focus-visible),prefers-reduced-motion, touch (touch-action,overscroll-behavior), hydration safety, image dimensions, locale (Intl.*), anti-pattern checklist. - rules/patterns.md — worked recipes: Dialog with form, AlertDialog confirm, Select, DropdownMenu, Sheet, Drawer, Responsive Modal (Dialog↔Drawer), Responsive App Shell (sidebar + mobile drawer), Tabs, Toasts, Tooltip, Cmd+K palette, Combobox, "adding components" pattern.
- rules/navigation.md — multi-page apps: React Router v7 routing (routes, params, nested layout routes, programmatic nav, 404), breadcrumbs, and URL-synced search / filter / sort / pagination.
Common mistakes
- Forgetting
<TooltipProvider>— must wrap the tree once. Without it,<Tooltip>renders nothing. asChildrequires exactly one child —<DialogTrigger asChild><Button>...</Button></DialogTrigger>. Two children → React error.onSelectvsonClickon menu items — Radix menu/command items fireonSelect.onClickworks but doesn't auto-close the menu.cmdkfilters by item text —<CommandItem value="...">is what's matched against the input. If you render JSX inside, setvalueexplicitly to control matching.- Native
<select>in forms — for styled selects, use theSelectcomponent, not<select>. Wrap withControllerforreact-hook-form.
04 同仓库更多 Skills
figma-use
**MANDATORY prerequisite** — you MUST invoke this skill BEFORE every `use_figma` tool call. NEVER call `use_figma` directly without loading this skill first. Skipping it causes common, hard-to-debug failures. Trigger whenever the user wants to perform a write action or a unique read action that requires JavaScript execution in the Figma file context — e.g. create/edit/delete nodes, set up variables or tokens, build components and variants, modify auto-layout or fills, bind variables to properties, or inspect file structure programmatically.
figma-use-slides
This skill helps agents use Figma's use_figma MCP tool in the Slides context. Can be used alongside figma-use which has foundational context for using the use_figma tool.
figma-use-motion
Motion / animation context for the `use_figma` MCP tool — animating Figma nodes via manual keyframes, animation styles, easing, and timeline duration. Load alongside figma-use whenever a task involves adding, editing, or inspecting animation on a node.
figma-use-figjam
This skill helps agents use Figma's use_figma MCP tool in the FigJam context. Can be used alongside figma-use which has foundational context for using the use_figma tool.
figma-swiftui
SwiftUI ↔ Figma translation. Use whenever the user mentions Swift, SwiftUI, iOS, iPhone, or iPad — in EITHER direction — translating a Figma design into SwiftUI (design → code), or pushing SwiftUI views / screens / tokens back into a Figma file (code → design). Triggers on phrases like 'implement this Figma design in SwiftUI', 'build this screen in Swift', 'push this SwiftUI view to Figma', 'mirror my Swift code in a Figma file', or whenever a Figma URL appears alongside `.swift` files / an `.xcodeproj`. Routes to a direction-specific reference doc; loads alongside `figma-use` for the code → design path.
figma-shaders
**MANDATORY prerequisite** — load this skill before calling `create_shader` or `update_shader`. Use when the user asks to create, author, change, fix, or iterate on a shader effect, shader fill, custom effect, custom fill, or procedural shader in Figma.