Accepted
We need a styling solution that:
- Supports dark mode
- Provides consistent design system
- Allows rapid development
- Has good performance
- Works well with React components
We will use Tailwind CSS v4 (beta) for styling.
- Rapid development: Utility classes speed up styling
- Dark mode: Built-in dark mode support with
dark:prefix - Consistency: Design tokens ensure consistent spacing, colors
- Performance: PurgeCSS removes unused styles
- No CSS conflicts: Utility classes avoid naming conflicts
- Responsive design: Mobile-first responsive utilities
- Customizable: Easy to extend with custom utilities
- HTML verbosity: Long class strings in components
- Learning curve: Need to learn utility class names
- Build dependency: Requires build step for optimization
- IDE support: Needs plugins for best experience
- Different approach from traditional CSS
- v4 beta may have some instability
<div className="bg-white dark:bg-gray-800 p-4 rounded-lg shadow-md">
<h2 className="text-lg font-semibold text-gray-900 dark:text-gray-100">
Title
</h2>
</div>// tailwind.config.js
export default {
darkMode: 'class',
content: ['./src/**/*.{ts,tsx}'],
theme: {
extend: {
// Custom extensions
}
}
}- CSS Modules: More boilerplate, slower development
- Styled Components: Runtime overhead, larger bundle
- Emotion: Similar to styled-components concerns
- Vanilla CSS: Too much manual work for consistency
- Material-UI: Too opinionated, larger bundle