Tailwind CSS
Utility-first CSS framework — build designs directly in your markup with CSS variables and modern features.
Read this to understand how Catalyst handles styling.
Useful when customizing the design system or adding new styles.
Why Tailwind CSS
Tailwind lets you build fast without leaving your HTML. Instead of writing CSS files, you apply utility classes directly to elements. This keeps styles colocated with components and makes it easy for AI agents to understand and modify designs.
Catalyst uses Tailwind v4, which introduces native CSS variables, better performance, and a simplified configuration. The design system is built on CSS custom properties, making theming straightforward.
Key Concepts
The Tailwind features Catalyst relies on:
CSS Variables
Design tokens as variables. Colors, spacing, and typography defined in CSS, used everywhere.
Dark Mode
Built-in dark mode. Toggle themes with the dark: variant and CSS variables.
Utility-First
Compose styles inline. No context switching between HTML and CSS files.
Catalyst Patterns
How Catalyst organizes styles:
CSS Variables (Critical)
Always use the --color- prefix for design tokens
/* Correct */ background: var(--color-background); color: var(--color-primary); /* Incorrect - won't work */ background: var(--background);
Transparency with OKLCH
Use oklch() for transparent colors
/* Correct - uses oklch for transparency */ background: oklch(from var(--color-primary) l c h / 0.1); /* Incorrect - hsl/rgb don't work with CSS variables */ background: hsl(var(--primary) / 0.1);
The cn() Utility
Merge Tailwind classes without conflicts
import { cn } from "@/lib/utils"
// Merges classes and handles conflicts
<div className={cn(
"p-4 bg-muted",
isActive && "bg-primary text-primary-foreground",
className
)} />Key Files
app/globals.cssRoot styles — imports design system, defines CSS variables
design/shared.cssDesign tokens — colors, typography, shadows
design/animate.cssAnimation utilities and keyframes
design/helpers.cssUtility classes for common patterns
tailwind.config.tsTailwind configuration (minimal in v4)
Color System
Catalyst uses semantic color tokens that adapt to light/dark mode:
--color-backgroundPage background
--color-foregroundPrimary text
--color-primaryBrand/accent color
--color-primary-foregroundText on primary
--color-mutedSubtle backgrounds
--color-muted-foregroundSecondary text
--color-borderBorders and dividers
--color-destructiveError/danger states
See /docs/design/colors for the full color reference.
Tips
No spacing/radius variables. Use direct values like p-4, rounded-lg — Tailwind handles the rest.
Use bg-muted for subtle backgrounds. It adapts to light/dark mode automatically.
Prefer Tailwind over custom CSS. Only write custom CSS for complex animations or truly unique patterns.
Dark mode uses the .dark class. The next-themes package handles the toggle.
Learn More
For AI Agents
Key rules:
- Always use
--color-prefix for CSS variables - Use
oklch(from var(--color-*) l c h / opacity)for transparency - Use
cn()utility from@/lib/utilsto merge classes - No spacing/radius CSS variables — use Tailwind classes directly
- Read
design/DESIGN.mdfor full conventions
Next Steps
Related foundation packages: