// UI implementation best practices and conventions for building user interfaces. Use this skill when implementing UI.
| name | ui-skill |
| description | UI implementation best practices and conventions for building user interfaces. Use this skill when implementing UI. |
app/ are React Server Components by defaultUse the "use client" directive at the top of a file when you need:
useState, useReducer)onClick, onChange, etc.)useEffect, useLayoutEffect)window, localStorage, geolocation)Keep components as Server Components when:
children props to Client Components to keep server-rendered contentNEXT_PUBLIC_ are exposed to the browserserver-only package to prevent accidental server code imports in Client ComponentsNotes: The registry name is ALWAYS @shadcn when using shadcn tools.
pnpm dlx shadcn@latest add [component] e.g. pnpm dlx shadcn@latest add button cardcomponents/ui/[component] folder"use client" to components that need interactivity"use client" directive to the lowest component that needs it (e.g., a button), not the parent container| Token | Meaning | Use |
|---|---|---|
background | Base canvas | Page background, global surfaces |
foreground | Primary text | Main body text, default icons |
| Token | Meaning | Use |
|---|---|---|
card | Elevated container | Cards, panels, modular content sections |
card-foreground | Text inside card | Headlines & body inside cards |
popover | Floating surface | Menus, dropdowns, tooltips |
popover-foreground | Text inside popovers | Menu text, tooltip text |
| Token | Meaning | Use |
|---|---|---|
muted | Subtle surface | Low-attention UI, placeholders, subtle blocks |
muted-foreground | Subtle text | Metadata, timestamps, helper labels |
| Token | Meaning | Use |
|---|---|---|
primary | Main brand / primary action | Primary buttons, strongest calls-to-action |
primary-foreground | Text on primary | Button text/icons on primary |
secondary | Supporting action | Secondary buttons, low-priority actions |
secondary-foreground | Text on secondary | Text/icons on secondary surfaces |
accent | Highlight / selection | Hover states, selected list items, subtle emphasis |
accent-foreground | Text on accent | Text inside accent states |
| Token | Meaning | Use |
|---|---|---|
destructive | Critical danger | Delete actions, destructive buttons |
destructive-foreground | Text on destructive | Text/icons on danger surfaces |
| Token | Meaning | Use |
|---|---|---|
border | Structural lines | Dividers, container edges, card borders |
input | Form affordance | Input borders/backgrounds |
ring | Focus halo | Keyboard focus states, accessibility outline |
| Token | Meaning | Use |
|---|---|---|
sidebar | App nav surface | Left nav panel background |
sidebar-foreground | Nav text | Sidebar labels & icons |
sidebar-primary | Nav primary action/highlight | Active item, nav CTA |
sidebar-primary-foreground | Text on sidebar primary | Text/icons in active nav |
sidebar-accent | Hover/selection in nav | Hover, sub-selection |
sidebar-accent-foreground | Text on nav accent | Text/icons |
sidebar-border | Nav separators | Sidebar boundaries |
sidebar-ring | Nav focus | Focus in navigation area |
| Token | Meaning | Use |
|---|---|---|
chart-1..5 | Categorical data colors | Data visualizations only (not UI) |
| Token | Meaning | Use |
|---|---|---|
radius | Base curvature | Global rounding scale for components |