shadcn-ui

Builds accessible, customizable component libraries using shadcn/ui with Radix UI or Base UI, Tailwind CSS 4, and React 19. Covers component ownership, oklch CSS theming, type-safe forms with Field and Zod, CLI workflows, and registry patterns. Use when adding shadcn/ui components, configuring themes, building forms with Zod, creating custom registries, or composing accessible component variants. Use for shadcn CLI, dark mode, component variants, form validation.

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "shadcn-ui" with this command: npx skills add oakoss/agent-skills/oakoss-agent-skills-shadcn-ui

shadcn/ui

Overview

Guides building accessible, customizable UI with shadcn/ui as a code generation platform (not an npm dependency). Components are copied into your project via the CLI and fully owned. Supports Radix UI or Base UI primitives, Tailwind CSS 4 with oklch color tokens, React 19 direct ref patterns, and type-safe form validation with the Field component and Zod.

When to use: Adding shadcn/ui components, theming with CSS variables and oklch colors, building forms with React Hook Form or TanStack Form, creating custom registries, composing accessible component variants, setting up dark mode.

When NOT to use: Non-React frameworks (use shadcn-vue or shadcn-svelte instead), projects using a different component library (MUI, Chakra), projects not using Tailwind CSS.

Quick Reference

PatternAPI / ApproachKey Points
Init projectnpx shadcn@latest initAuto-detects framework, configures CSS variables
Add componentnpx shadcn@latest add [name]Copies source code into your project
Custom projectnpx shadcn@latest createPick library (Radix/Base UI), style, theme, fonts
Check updatesnpx shadcn@latest diff [component]Shows upstream changes for your components
Search registrynpx shadcn@latest search @registryBrowse and install from namespaced registries
Build registrynpx shadcn@latest buildGenerate registry JSON from registry.json
Theme tokens:root vars + @theme inline mappingoklch color values, dark mode via .dark class
Dark mode@custom-variant dark (&:is(.dark *))Swaps CSS variables under .dark selector
Component variantcva() from class-variance-authorityType-safe variant definitions
Polymorphic slotasChild prop with <Slot> from RadixMerge props onto child element
Direct refref as a regular propforwardRef is deprecated in React 19
Form (current)<Field /> + React Hook Form + ZodReplaces legacy <Form /> component
Form (legacy)<Form /> + <FormField /> + ZodStill works but no longer actively developed
Class mergingcn() utility wrapping clsx + twMergeSafely merge Tailwind classes without conflicts
Toast / notificationSonner (npx shadcn@latest add sonner)Default notification approach; auto-dismiss, stacking
Init with blocksnpx shadcn@latest init sidebar-01Bootstrap project with pre-built page blocks
RTL supportdir="rtl" on root elementBuilt-in RTL layout support for all components
New componentsSpinner, Kbd, ButtonGroupRecently added utility and layout components

Common Mistakes

MistakeCorrect Pattern
Installing shadcn/ui as an npm dependencyUse the CLI (npx shadcn@latest add) to copy source into your project
Using forwardRef with React 19 componentsPass ref directly as a prop -- forwardRef is deprecated in React 19
Using HSL values for color tokensUse oklch format: --primary: oklch(0.205 0 0)
Wrapping variables with hsl() or oklch() in utilitiesReference CSS variables directly: var(--primary)
Putting tokens directly in @theme {}Use :root for values + @theme inline to map them to Tailwind
Using legacy <Form /> for new formsUse <Field /> component with React Hook Form or TanStack Form
Skipping Zod validation in form componentsAlways pair forms with Zod schemas for type-safe validation
Using div elements for interactive controlsUse Radix or Base UI primitives for semantic HTML and accessibility
Modifying components in node_modulesComponents live in your source tree -- own and customize directly
Using old CLI command shadcn-ui@canaryUse npx shadcn@latest for all CLI operations

Delegation

  • Component discovery and primitive lookup: Use Explore agent
  • Theme migration or multi-file refactoring: Use Task agent
  • Design system architecture planning: Use Plan agent
  • Registry setup and distribution: Use Task agent

If the tanstack-form skill is available, delegate advanced form state management (array fields, linked fields, async validation) to it. If the tailwind skill is available, delegate utility class patterns and design token architecture to it.

References

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

Coding

github-cli

No summary provided by upstream source.

Repository SourceNeeds Review
Coding

tanstack-cli

No summary provided by upstream source.

Repository SourceNeeds Review
Coding

typescript-patterns

No summary provided by upstream source.

Repository SourceNeeds Review
Coding

tanstack-devtools

No summary provided by upstream source.

Repository SourceNeeds Review