How to work effectively with shadcn/ui components, always use when adding UI components
/plugin marketplace add markhamsquareventures/essentials/plugin install essentials@mksq-marketplaceThis skill inherits all available tools. When active, it can use any tool Claude has access to.
This project uses shadcn/ui with the New York style variant. Components are built on Radix UI primitives with Tailwind CSS styling.
new-yorkneutrallucide-reactresources/js/components/ui/resources/js/lib/utils.tsUse the shadcn CLI to add components:
npx shadcn@latest add <component-name>
Examples:
npx shadcn@latest add table
npx shadcn@latest add tabs
npx shadcn@latest add calendar
Do NOT manually create shadcn components - always use the CLI to ensure correct styling and dependencies.
Components already installed in this project:
alertalert-dialogavatarbadgebreadcrumbbuttoncardcheckboxcollapsibledialogdropdown-menuinput, input-otplabelnavigation-menuselectseparatorsheetsidebarskeletonsonner (toast notifications)spinnertoggle, toggle-grouptooltipAlways import from @/components/ui/:
{/_ Sizes _/} <Button size="sm">Small</Button> <Button size="default">Default</Button> <Button size="lg">Large</Button> <Button size="icon"><IconComponent /></Button> </code-snippet>
Use Label + Input together, with proper error styling:
<code-snippet name="Form Field Pattern" lang="tsx"> import { Label } from '@/components/ui/label'; import { Input } from '@/components/ui/input'; <div className="space-y-2"> <Label htmlFor="email">Email</Label> <Input id="email" name="email" type="email" placeholder="you@example.com" aria-invalid={!!errors.email} /> {errors.email && ( <p className="text-sm text-destructive">{errors.email}</p> )} </div> </code-snippet>Use Sonner for toast notifications:
<code-snippet name="Toast Usage" lang="tsx"> import { toast } from 'sonner';// Success toast.success('Changes saved successfully');
// Error toast.error('Something went wrong');
// With description toast.success('Project created', { description: 'Your new project is ready to use.', }); </code-snippet>
Use cn() from @/lib/utils to merge Tailwind classes conditionally:
Use Lucide React for icons:
<code-snippet name="Icon Usage" lang="tsx"> import { Plus, Trash2, Edit, ChevronRight } from 'lucide-react'; <Button> <Plus /> Add Item </Button> <Button variant="ghost" size="icon"> <Trash2 /> </Button> </code-snippet>