/** * 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 (
← Back to Home

Tailwind CSS Demo

Utility-first CSS framework with custom design system.

{/* Tab Navigation */}
{(['utilities', 'responsive', 'dark'] as const).map((tab) => ( ))}
{/* Utilities Tab */} {activeTab === 'utilities' && (

Spacing & Layout

p-2
p-4
p-6
m-2

Typography

text-xs - Extra small

text-sm - Small

text-base - Base

text-lg font-medium

text-xl font-semibold

text-2xl font-bold

Colors

{['primary', 'gray', 'red', 'green', 'blue'].map((color) => (

{color}

))}

Flexbox & Grid

flex-1
flex-1
flex-1
col
col
col
)} {/* Responsive Tab */} {activeTab === 'responsive' && (

Breakpoint Prefixes

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)

Responsive Grid (Resize to see)

{[1, 2, 3, 4, 5, 6, 7, 8].map((n) => (
Item {n}
))}

Responsive Text

This text scales with viewport size

{`{/* Mobile-first responsive design */}
{items.map(item => )}
`}
)} {/* Dark Mode Tab */} {activeTab === 'dark' && (

Dark Mode Variants

Primary text

Secondary text

Muted text

Component Examples

Card Component

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' // ... }`}
)}
{/* Custom Design System */}

Custom Design System

Custom Components

Badge

Custom Input

Card Component

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;
  }
}`}
          
); }