---
name: ui-patterns
description: UI design patterns for React + TailwindCSS. Use when creating new UI components, styling elements, implementing dark mode support, or working on any React component that needs consistent styling.
---
# UI Patterns
## Required: Dark Mode Support
All UI components MUST support dark mode using Tailwind's `class` strategy.
```tsx
// Always provide dark: variants
className="bg-white dark:bg-slate-900 text-slate-900 dark:text-white"
```
## Color System
### Brand Colors (Blue) - Primary actions
- `brand-500` / `brand-600` - Primary buttons, links
- `brand-100` / `dark:brand-900/30` - Highlighted backgrounds
- `brand-700` / `dark:brand-300` - Text on brand backgrounds
### System Colors (Slate) - UI chrome
- `slate-50` / `dark:slate-950` - Page backgrounds
- `slate-100` / `dark:slate-800` - Secondary/card backgrounds
- `slate-200` / `dark:slate-700` - Borders
- `slate-400` - Muted text
- `slate-700` / `dark:white` - Primary text
### Semantic Colors
- Success: `emerald-*` (done, approved)
- Warning: `amber-*` (pending, paused)
- Error: `red-*` (failed, stopped)
## Component Classes
Use pre-defined component classes for consistency:
```tsx
// Buttons
// Inputs
// Select dropdowns
// Cards
Content
```
## Status Badges
Use consistent status badge pattern with icons:
```tsx
const STATUS_CONFIG = {
backlog: { icon: "inbox", classes: "bg-slate-100 text-slate-700 border-slate-200 dark:bg-slate-800 dark:text-slate-300 dark:border-slate-700" },
ready: { icon: "circle-dashed", classes: "bg-slate-100 text-slate-700 border-slate-200 dark:bg-slate-800 dark:text-slate-300 dark:border-slate-700" },
in_progress: { icon: "timer", classes: "bg-blue-100 text-blue-700 border-blue-200 dark:bg-blue-900/30 dark:text-blue-300 dark:border-blue-800" },
pending_review: { icon: "eye", classes: "bg-amber-100 text-amber-700 border-amber-200 dark:bg-amber-900/30 dark:text-amber-300 dark:border-amber-800" },
done: { icon: "check-circle", classes: "bg-emerald-100 text-emerald-700 border-emerald-200 dark:bg-emerald-900/30 dark:text-emerald-300 dark:border-emerald-800" },
};
// Badge structure
{label}
```
## Typography
```tsx
// Page titles
// Section titles
// Subsection headers (uppercase)
```
## Layout Patterns
### Split Pane (50/50)
```tsx
{/* Left panel */}
{/* Right panel */}
```
### Section Card
```tsx
Section Title
{/* Content */}
```
## Modal Pattern
```tsx
{/* Header */}
Title
{/* Body */}
...
{/* Footer */}
```
## Spacing Guidelines
| Size | Usage |
|------|-------|
| `gap-1.5` | Icon + text in badges |
| `gap-2` | Button groups |
| `gap-3` | Form fields |
| `gap-4` | Section spacing |
| `gap-6` | Major section spacing |
| `p-4` | Card padding |
| `p-6` | Modal/panel padding |
## Scrollbars
Use `.scrollbar-thin` for custom scrollbars:
```tsx
```
## Loading States
```tsx
// Skeleton loader
// Spinner
```
## Empty States
```tsx
No items found
Get started by creating your first item.
```