Overview
Stride Design System uses Tailwind CSS v4 with semantic tokens and class-variance-authority (cva) for managing component variants. This approach provides type-safe styling with excellent developer experience.Tailwind CSS v4 Integration
Configuration
Stride uses Tailwind CSS v4 with inline theme configuration and CSS custom properties:src/styles.css
Semantic Tokens
All components use semantic CSS custom properties for theming:The cn() Utility Function
Stride provides a utility function for merging class names with Tailwind CSS:src/lib/utils.ts
How it Works
- clsx: Conditionally constructs className strings
- twMerge: Intelligently merges Tailwind classes, removing conflicts
Usage Examples
Class Variance Authority (cva)
Overview
cva provides type-safe variant management for component styling. Every Stride component uses cva for consistent variant handling.Basic Pattern
Real-World Examples
Button Component
Here’s how the Button component uses cva with semantic tokens:src/components/ui/Button/Button.tsx
Badge Component
The Badge component demonstrates multiple variant types:src/components/ui/Badge/Badge.tsx
Compound Variants
Use compound variants for combinations of variant states:src/components/ui/Card/Card.tsx
Custom Component Styling
Extending Components
All Stride components accept aclassName prop for customization:
Creating Custom Variants
You can create your own variants using the same pattern:Best Practices
Use Semantic Tokens
Always use CSS custom properties instead of hardcoded values for better theming support.
Leverage cn() Utility
Use the cn() function to merge classes intelligently and avoid conflicts.
Type-Safe Variants
Extend VariantProps to get full TypeScript support for your component props.
Consistent Patterns
Follow the established cva pattern across all custom components for consistency.
Dark Mode Support
Stride automatically supports dark mode through CSS custom properties:Next Steps
TypeScript Guide
Learn about TypeScript patterns and type exports
Contributing
Create your own components following our patterns