/** * Tailwind CSS Demo Page * Demonstrates utility-first CSS patterns and custom design system */ import { useState } from 'react'; import { Link } from 'react-router-dom'; export default function TailwindDemo() { const [activeTab, setActiveTab] = useState<'utilities' | 'responsive' | 'dark'>('utilities'); return (
Utility-first CSS framework with custom design system.
text-xs - Extra small
text-sm - Small
text-base - Base
text-lg font-medium
text-xl font-semibold
text-2xl font-bold
{color}
| Prefix | Min Width | CSS |
|---|---|---|
| sm: | 640px | @media (min-width: 640px) |
| md: | 768px | @media (min-width: 768px) |
| lg: | 1024px | @media (min-width: 1024px) |
| xl: | 1280px | @media (min-width: 1280px) |
| 2xl: | 1536px | @media (min-width: 1536px) |
This text scales with viewport size
{`{/* Mobile-first responsive design */}
{items.map(item => )}
`}
Primary text
Secondary text
Muted text
This card adapts to light and dark mode automatically using Tailwind's dark: prefix.
{`{/* Dark mode usage */}
Secondary text that adapts
{/* In tailwind.config.js */}
module.exports = {
darkMode: 'class', // or 'media'
// ...
}`}
This uses the custom .card class with gradient background.
{`/* tailwind.config.js - Extending theme */
module.exports = {
theme: {
extend: {
colors: {
primary: {
50: '#eff6ff',
100: '#dbeafe',
// ... custom color palette
600: '#2563eb',
700: '#1d4ed8',
},
},
},
},
}
/* index.css - Custom component classes */
@layer components {
.btn-primary {
@apply px-4 py-2 bg-primary-600 text-white rounded
hover:bg-primary-700 transition-colors;
}
.card {
@apply p-6 bg-white dark:bg-gray-900
border border-gray-200 dark:border-gray-800
rounded-lg;
}
.input {
@apply w-full px-3 py-2
bg-white dark:bg-gray-800
border border-gray-300 dark:border-gray-600
rounded focus:ring-2 focus:ring-primary-500;
}
}`}