Loading...
Loading...
Manages shadcn components and projects — adding, searching, fixing, debugging, styling, and composing UI. Provides project context, component docs, and usage examples. Applies when working with shadcn/ui, component registries, presets, --preset codes, or any project with a components.json file. Also triggers for "shadcn init", "create an app with --preset", or "switch to --preset".
npx skill4agent add shadcn/ui shadcnIMPORTANT: Run all CLI commands using the project's package runner:,npx shadcn@latest, orpnpm dlx shadcn@latest— based on the project'sbunx --bun shadcn@latest. Examples below usepackageManagerbut substitute the correct runner for the project.npx shadcn@latest
!`npx shadcn@latest info --json 2>/dev/null || echo '{"error": "No shadcn project found. Run shadcn init first."}'`npx shadcn@latest docs <component>npx shadcn@latest searchvariant="outline"size="sm"bg-primarytext-muted-foregroundbg-blue-500classNamespace-x-*space-y-*flexgap-*flex flex-col gap-*size-*size-10w-10 h-10truncateoverflow-hidden text-ellipsis whitespace-nowrapdark:bg-backgroundtext-muted-foregroundcn()z-indexFieldGroupFielddivspace-y-*grid gap-*InputGroupInputGroupInputInputGroupTextareaInputTextareaInputGroupInputGroupInputGroupAddonToggleGroupButtonFieldSetFieldLegenddivdata-invalidaria-invaliddata-invalidFieldaria-invaliddata-disabledFielddisabledSelectItemSelectGroupDropdownMenuItemDropdownMenuGroupCommandItemCommandGroupasChildrenderbasenpx shadcn@latest infoDialogTitleSheetTitleDrawerTitleclassName="sr-only"CardHeaderCardTitleCardDescriptionCardContentCardFooterCardContentisPendingisLoadingSpinnerdata-icondisabledTabsTriggerTabsListTabsAvatarAvatarFallbackdivAlertEmptysonnertoast()sonnerSeparator<hr><div className="border-t">Skeletonanimate-pulseBadgeButtondata-icondata-icon="inline-start"data-icon="inline-end"size-4w-4 h-4icon={CheckIcon}npx shadcn@latest init --preset <code>// Form layout: FieldGroup + Field, not div + Label.
<FieldGroup>
<Field>
<FieldLabel htmlFor="email">Email</FieldLabel>
<Input id="email" />
</Field>
</FieldGroup>
// Validation: data-invalid on Field, aria-invalid on the control.
<Field data-invalid>
<FieldLabel>Email</FieldLabel>
<Input aria-invalid />
<FieldDescription>Invalid email.</FieldDescription>
</Field>
// Icons in buttons: data-icon, no sizing classes.
<Button>
<SearchIcon data-icon="inline-start" />
Search
</Button>
// Spacing: gap-*, not space-y-*.
<div className="flex flex-col gap-4"> // correct
<div className="space-y-4"> // wrong
// Equal dimensions: size-*, not w-* h-*.
<Avatar className="size-10"> // correct
<Avatar className="w-10 h-10"> // wrong
// Status colors: Badge variants or semantic tokens, not raw colors.
<Badge variant="secondary">+20.1%</Badge> // correct
<span className="text-emerald-600">+20.1%</span> // wrong| Need | Use |
|---|---|
| Button/action | |
| Form inputs | |
| Toggle between 2–5 options | |
| Data display | |
| Navigation | |
| Overlays | |
| Feedback | |
| Command palette | |
| Charts | |
| Layout | |
| Empty states | |
| Menus | |
| Tooltips/info | |
aliases@/~/isRSCtrueuseStateuseEffect"use client"tailwindVersion"v4"@theme inline"v3"tailwind.config.jstailwindCssFilestylenovavegabaseradixbaseiconLibrarylucide-reactlucide@tabler/icons-reacttablerlucide-reactresolvedPathsframeworkpackageManagerpnpm add date-fnsnpm install date-fnsinfonpx shadcn@latest docs <component>npx shadcn@latest docs button dialog selectnpx shadcn@latest docsnpx shadcn@latest infoaddcomponentsresolvedPaths.uinpx shadcn@latest searchnpx shadcn@latest docs <component>npx shadcn@latest viewnpx shadcn@latest add --diffnpx shadcn@latest add--dry-run--diff@bundui@magicui@/components/ui/...npx shadcn@latest infoui@workspace/ui/componentsSelectItemSelectGroupiconLibrarylucide-reacthugeicons@shadcn@tailarknpx shadcn@latest init --preset <code> --force --reinstallnpx shadcn@latest init --preset <code> --force --no-reinstallnpx shadcn@latest info--dry-run--diffnpx shadcn@latest init --preset <code> --force --no-reinstall--dry-run--diffnpx shadcn@latest add <component> --dry-runnpx shadcn@latest add <component> --diff <file>--overwrite--overwrite# Create a new project.
npx shadcn@latest init --name my-app --preset base-nova
npx shadcn@latest init --name my-app --preset a2r6bw --template vite
# Create a monorepo project.
npx shadcn@latest init --name my-app --preset base-nova --monorepo
npx shadcn@latest init --name my-app --preset base-nova --template next --monorepo
# Initialize existing project.
npx shadcn@latest init --preset base-nova
npx shadcn@latest init --defaults # shortcut: --template=next --preset=base-nova
# Add components.
npx shadcn@latest add button card dialog
npx shadcn@latest add @magicui/shimmer-button
npx shadcn@latest add --all
# Preview changes before adding/updating.
npx shadcn@latest add button --dry-run
npx shadcn@latest add button --diff button.tsx
npx shadcn@latest add @acme/form --view button.tsx
# Search registries.
npx shadcn@latest search @shadcn -q "sidebar"
npx shadcn@latest search @tailark -q "stats"
# Get component docs and example URLs.
npx shadcn@latest docs button dialog select
# View registry item details (for items not yet installed).
npx shadcn@latest view @shadcn/buttonbase-novaradix-novanextvitestartreact-routerastro--monorepolaravelaa2r6bw