home / skills / yuniorglez / gemini-elite-core / shadcn-ui-expert

shadcn-ui-expert skill

/skills/shadcn-ui-expert

This skill helps you implement shadcn/ui with CSS-first Tailwind 4, accessible Radix primitives, and React 19 patterns for scalable design systems.

npx playbooks add skill yuniorglez/gemini-elite-core --skill shadcn-ui-expert

Review the files below or copy the command above to add this skill to your agents.

Files (3)
SKILL.md
4.5 KB
---
name: shadcn-ui-expert
description: Senior UI Engineer & Design System Specialist for shadcn/ui (2026). Specialized in building accessible, highly customizable, and performant component libraries using Radix UI 2026, Tailwind CSS 4 (CSS-First), and React 19. Expert in component ownership, modular architectures, and type-safe UI patterns.
---

# 🎨 Skill: shadcn-ui-expert (v1.0.0)

## Executive Summary
Senior UI Engineer & Design System Specialist for shadcn/ui (2026). Specialized in building accessible, highly customizable, and performant component libraries using Radix UI 2026, Tailwind CSS 4 (CSS-First), and React 19. Expert in component ownership, modular architectures, and type-safe UI patterns.

---

## 📋 The Conductor's Protocol

1.  **Component Strategy**: Do not treat shadcn/ui as a library; treat it as a **code generation template**. Own the code.
2.  **Tailwind 4 Workflow**: Prioritize CSS-first configuration using `@theme` and `@utility`. Avoid `tailwind.config.js` for new projects.
3.  **Accessibility First**: Every component MUST inherit Radix primitives for keyboard navigation and ARIA compliance.
4.  **Verification**: Use `bun x shadcn-ui@canary add` for new components and verify styles against the 2026 Bento Grid standards.

---

## 🛠️ Mandatory Protocols (2026 Standards)

### 1. Tailwind 4 (CSS-First)
As of 2026, shadcn/ui has migrated to a CSS-based configuration.
- **Rule**: Define design tokens (colors, spacing) in `globals.css` using the `@theme` block.
- **Directive**: Replace `@tailwind base;` with `@import "tailwindcss";`.

### 2. React 19 Compatibility
- **Rule**: Use the direct `ref` prop. `forwardRef` is deprecated.
- **Actions**: Integrate `useFormStatus` and `useFormState` into shadcn/ui `Form` components for native Server Action feedback.

### 3. Canary CLI Usage
- **Rule**: Always use `bun x shadcn-ui@canary` to ensure compatibility with Tailwind 4 and React 19 during initialization and component addition.

---

## 🚀 Show, Don't Just Tell (Implementation Patterns)

### Quick Start: Tailwind 4 / CSS-First Theme
```css
/* globals.css */
@import "tailwindcss";

@theme {
  --color-primary: hsl(222.2 47.4% 11.2%);
  --color-primary-foreground: hsl(210 40% 98%);
  --radius-lg: 1rem; /* 2026 Bento Standard */
}

@utility focus-ring {
  @apply ring-2 ring-primary ring-offset-2;
}
```

### Advanced Pattern: React 19 Direct Ref Component
```tsx
// components/ui/button.tsx
import * as React from "react";
import { Slot } from "@radix-ui/react-slot";
import { cva, type VariantProps } from "class-variance-authority";
import { cn } from "@/lib/utils";

const buttonVariants = cva("...", { ... });

interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> {
  asChild?: boolean;
}

// React 19: ref is passed directly as a prop
export function Button({ className, variant, size, asChild = false, ref, ...props }: ButtonProps) {
  const Comp = asChild ? Slot : "button";
  return (
    <Comp
      className={cn(buttonVariants({ variant, size, className }))}
      ref={ref}
      {...props}
    />
  );
}
```

---

## 🛡️ The Do Not List (Anti-Patterns)

1.  **DO NOT** install shadcn/ui as an npm package dependency. Always use the CLI to add source code.
2.  **DO NOT** modify components in `node_modules`. Components live in `src/components/ui`.
3.  **DO NOT** use `div` for buttons. Leverage Radix's `Button` or `Slot` for semantic integrity.
4.  **DO NOT** ignore `globals.css` variables. Standardize on the HSL variable system for easy dark mode toggling.
5.  **DO NOT** skip Zod validation in forms. shadcn/ui `Form` components are optimized for Zod schemas.

---

## 📂 Progressive Disclosure (Deep Dives)

- **[Tailwind 4 Migration](./references/tailwind-4-migration.md)**: Transitioning from JS config to CSS-first.
- **[Radix 2026 Primitives](./references/radix-2026.md)**: Latest accessible headless components.
- **[React 19 Form Patterns](./references/react-19-forms.md)**: `use()` hook and Server Actions in UI.
- **[Bento Grid & shadcn/ui](./references/bento-grid-ui.md)**: Building modular layouts with Cards and Sheets.

---

## 🛠️ Specialized Tools & Scripts

- `scripts/init-tailwind4.sh`: Scaffolds a shadcn project with Tailwind 4 canary.
- `scripts/sync-ui-themes.ts`: Synchronizes CSS variables with Figma design tokens.

---

## 🎓 Learning Resources
- [Official shadcn/ui Docs](https://ui.shadcn.com/)
- [Tailwind CSS v4 Docs](https://tailwindcss.com/docs/v4-beta)
- [Radix UI Primitives](https://www.radix-ui.com/)

---
*Updated: January 23, 2026 - 17:55*

Overview

This skill is a Senior UI Engineer and Design System Specialist focused on shadcn/ui (2026). It codifies patterns for building accessible, customizable, and high-performance component libraries using Radix UI 2026, Tailwind CSS 4 (CSS-First), and React 19. The guidance emphasizes component ownership, modular architectures, and type-safe UI patterns for production apps.

How this skill works

The skill inspects project structure, CSS theme tokens, and component implementation patterns to ensure they follow the 2026 protocols. It verifies that components use Radix primitives, CSS-first Tailwind 4 themes in globals.css, and React 19 direct ref patterns. It also recommends CLI commands and scripts for safe scaffolding and synchronization of design tokens with Figma.

When to use it

  • Starting a new shadcn/ui-based design system or component library.
  • Migrating an existing codebase to Tailwind CSS 4 (CSS-first) and React 19 patterns.
  • Auditing component accessibility and Radix primitive usage.
  • Scaffolding components with the canary CLI to ensure compatibility.
  • Enforcing type-safe form patterns with Zod and server-action feedback.

Best practices

  • Treat shadcn/ui as a code generation template and own the generated source in src/components/ui.
  • Define design tokens in globals.css with @theme and use @utility blocks for reusable utilities.
  • Always inherit Radix primitives for keyboard and ARIA behavior; avoid replacing semantics with plain divs.
  • Use direct ref props per React 19 and wire useFormState/useFormStatus into Form components for Server Actions.
  • Use bun x shadcn-ui@canary when initializing or adding components to match Tailwind 4 compatibility.
  • Keep components out of node_modules; modify only the source in your repo and sync tokens with the provided scripts.

Example use cases

  • Scaffold a new app with scripts/init-tailwind4.sh and canary CLI, then customize globals.css tokens.
  • Refactor Button and Form components to use direct ref props, Radix primitives, and Zod validation.
  • Audit a legacy shadcn/ui integration to replace JS-based tailwind.config.js with CSS-first @theme tokens.
  • Sync CSS variables with Figma using scripts/sync-ui-themes.ts as part of your release pipeline.
  • Create a modular Card + Sheet pattern that follows the 2026 Bento Grid spacing and radius tokens.

FAQ

Do I install shadcn/ui as an npm dependency?

No. Do not install shadcn/ui from npm. Use the CLI to add generated source code and keep components in your repo under src/components/ui.

How do I define theme tokens in Tailwind 4?

Put design tokens in globals.css inside an @theme block and import Tailwind via @import "tailwindcss". Use HSL variables for easy dark mode toggling.