All skills
shadcn-ui avatar

/shadcn

@6cd3f4c
by shadcn-uishadcn-ui/ui125k stars
11,817

Manages shadcn components and projects — adding, searching, fixing, debugging, styling, and composing UI, including chat interfaces. 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".

Use this Skill: https://skilld.dev/gh/shadcn-ui/ui/shadcn

This session only. Nothing lands on disk.

rulescomposition.md

≈1.2k tokens on demand. Your agent reads this file only when SKILL.md points to it.

Component Composition

Contents

  • Items always inside their Group component
  • Callouts use Alert
  • Empty states use Empty component
  • Toast notifications follow the project base
  • Choosing between overlay components
  • Dialog, Sheet, and Drawer always need a Title
  • Card structure
  • Button has no isPending or isLoading prop
  • TabsTrigger must be inside TabsList
  • Avatar always needs AvatarFallback
  • Use Separator instead of raw hr or border divs
  • Use Skeleton for loading placeholders
  • Use Badge instead of custom styled spans

Items always inside their Group component

Never render items directly inside the content container.

Incorrect:

<SelectContent>
  <SelectItem value="apple">Apple</SelectItem>
  <SelectItem value="banana">Banana</SelectItem>
</SelectContent>

Correct:

<SelectContent>
  <SelectGroup>
    <SelectItem value="apple">Apple</SelectItem>
    <SelectItem value="banana">Banana</SelectItem>
  </SelectGroup>
</SelectContent>

This applies to all group-based components:

Item Group
SelectItem, SelectLabel SelectGroup
DropdownMenuItem, DropdownMenuLabel, DropdownMenuSub DropdownMenuGroup
MenubarItem MenubarGroup
ContextMenuItem ContextMenuGroup
CommandItem CommandGroup
MessageScrollerItem MessageScrollerContent
Message (consecutive, same sender) MessageGroup
Bubble (stacked) BubbleGroup
Attachment (in a row) AttachmentGroup

Chat components nest in a fixed order (MessageScrollerProvider → MessageScroller → MessageScrollerViewport → MessageScrollerContent → MessageScrollerItem). See chat.md.


Callouts use Alert

<Alert>
  <AlertTitle>Warning</AlertTitle>
  <AlertDescription>Something needs attention.</AlertDescription>
</Alert>

Empty states use Empty component

<Empty>
  <EmptyHeader>
    <EmptyMedia variant="icon"><FolderIcon /></EmptyMedia>
    <EmptyTitle>No projects yet</EmptyTitle>
    <EmptyDescription>Get started by creating a new project.</EmptyDescription>
  </EmptyHeader>
  <EmptyContent>
    <Button>Create Project</Button>
  </EmptyContent>
</Empty>

Toast notifications follow the project base

For Base UI projects, use the toast component:

import { toast } from "@/components/ui/toast"

toast.add({
  title: "Changes saved.",
})

For Radix and React Aria projects, use Sonner:

import { toast } from "sonner"

toast.success("Changes saved.")
toast.error("Something went wrong.")
toast("File deleted.", {
  action: { label: "Undo", onClick: () => undoDelete() },
})

Choosing between overlay components

Use case Component
Focused task that requires input Dialog
Destructive action confirmation AlertDialog
Side panel with details or filters Sheet
Mobile-first bottom panel Drawer
Quick info on hover HoverCard
Small contextual content on click Popover

Dialog, Sheet, and Drawer always need a Title

DialogTitle, SheetTitle, DrawerTitle are required for accessibility. Use className="sr-only" if visually hidden.

<DialogContent>
  <DialogHeader>
    <DialogTitle>Edit Profile</DialogTitle>
    <DialogDescription>Update your profile.</DialogDescription>
  </DialogHeader>
  ...
</DialogContent>

Card structure

Use full composition — don't dump everything into CardContent:

<Card>
  <CardHeader>
    <CardTitle>Team Members</CardTitle>
    <CardDescription>Manage your team.</CardDescription>
  </CardHeader>
  <CardContent>...</CardContent>
  <CardFooter>
    <Button>Invite</Button>
  </CardFooter>
</Card>

Button has no isPending or isLoading prop

Compose with Spinner + data-icon + disabled:

<Button disabled>
  <Spinner data-icon="inline-start" />
  Saving...
</Button>

TabsTrigger must be inside TabsList

Never render TabsTrigger directly inside Tabs — always wrap in TabsList:

<Tabs defaultValue="account">
  <TabsList>
    <TabsTrigger value="account">Account</TabsTrigger>
    <TabsTrigger value="password">Password</TabsTrigger>
  </TabsList>
  <TabsContent value="account">...</TabsContent>
</Tabs>

Avatar always needs AvatarFallback

Always include AvatarFallback for when the image fails to load:

<Avatar>
  <AvatarImage src="/avatar.png" alt="User" />
  <AvatarFallback>JD</AvatarFallback>
</Avatar>

Use existing components instead of custom markup

Instead of Use
<hr> or <div className="border-t"> <Separator />
<div className="animate-pulse"> with styled divs <Skeleton className="h-4 w-3/4" />
<span className="rounded-full bg-green-100 ..."> <Badge variant="secondary">

Source: SKILL.md on GitHub

1 warning16d5 checks · Risk SAFE
  • Gen Agent Trust Hub16d

    This is the official skill for managing shadcn/ui components and projects. It utilizes the shadcn CLI to synchronize project context, search registries, and install UI components. The skill provides detailed architectural and styling rules to ensure the agent generates high-quality code consistent with shadcn/ui principles. No security risks were identified beyond the standard operations of the development tools it manages.

  • Socket16d

    1 alert: gptAnomaly

  • Snyk16d

    Risk: LOW · No issues

  • Runlayer6mo

    11 files scanned · No issues

  • ZeroLeaks5mo

    Score: 93/100 · 2 sections analyzed

Signed by skilld at 6cd3f4c. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub yesterday.

Activeupdated 2 months ago
What it can do
Runs commands
user-invocable
false
All 3 allowed tools
Bash(npx shadcn@latest *)Bash(pnpm dlx shadcn@latest *)Bash(bunx --bun shadcn@latest *)

README badge

README badge for shadcn-ui/ui/shadcn