Overview
The@repo/ui component library uses Tailwind CSS v4 with a comprehensive design token system. All components support theming through CSS variables, enabling both light and dark modes with easy customization.
Design Token System
The library defines design tokens using CSS variables in@theme blocks. These tokens are automatically mapped to Tailwind utilities.
Color Tokens
The component library uses semantic color tokens that adapt to light and dark modes:- Light Mode
- Dark Mode
Button Tokens
Special tokens for button variants:Tailwind CSS v4 Configuration
The library uses Tailwind v4’s new@theme directive and inline source scanning:
src/styles.css
PostCSS Configuration
Minimal PostCSS setup for Tailwind v4:postcss.config.mjs
Customizing Colors
Method 1: Override CSS Variables
Override design tokens in your app’s CSS:app/globals.css
Method 2: Extend with Tailwind Classes
Add custom classes alongside component variants:Method 3: Create Custom Variants
Extend component variants using CVA:Dark Mode
Enabling Dark Mode
Dark mode is enabled by adding thedark class to a parent element:
app/layout.tsx
System Preference Detection
Detect and respect system color scheme:app/theme-provider.tsx
Semantic Color System
The library includes semantic colors for status and feedback:Status Colors
Using Semantic Colors
Custom Animations
The library includes custom animations viatw-animate-css:
Typography
The library uses the Outfit font family:Border Radius
Consistent border radius:Gradient Borders
The library includes special gradient border styles for buttons:Custom Utilities
The library provides custom utility classes:Complete Theme Example
Here’s a complete example of customizing the theme:Best Practices
Use Semantic Tokens
Use Semantic Tokens
Prefer semantic color tokens over hardcoded values:
Maintain Dark Mode Support
Maintain Dark Mode Support
Always test customizations in both light and dark modes:
Extend, Don't Override
Extend, Don't Override
Use className to extend rather than override:
Keep Tokens Consistent
Keep Tokens Consistent
Use existing design tokens for consistency:
Next Steps
Component Overview
Explore all themed components
Usage Guide
Learn component usage patterns
Storybook
See components with different themes
Installation
Setup guide for theming