# Responsive Design Reference Detailed reference for implementing responsive, mobile-first designs. ## Mobile-First Approach Always start with mobile design, then progressively enhance for larger screens. **Why Mobile-First:** - Forces focus on essential content - Easier to scale up than scale down - Better performance on mobile devices - Aligns with usage patterns (mobile-first web) ## Breakpoint Strategy ### Standard Breakpoints ```css /* Mobile First Approach */ /* Base styles: 0-640px (mobile) */ /* Small tablets and large phones */ @media (min-width: 640px) { } /* Tablets */ @media (min-width: 768px) { } /* Small laptops */ @media (min-width: 1024px) { } /* Desktops */ @media (min-width: 1280px) { } /* Large desktops */ @media (min-width: 1536px) { } ``` ### Specific Breakpoint Ranges | Range | Pixels | Target Devices | Layout Strategy | |-------|--------|----------------|-----------------| | **XS** | 0-479px | Small phones (iPhone SE, older Android) | Single column, stacked navigation, large touch targets (min 44px) | | **SM** | 480-767px | Large phones (iPhone 14, most modern phones) | Single column, simplified UI, bottom navigation, reduced complexity | | **MD** | 768-1023px | Tablets (iPad, Android tablets) | 2 columns possible, sidebar navigation, some desktop features | | **LG** | 1024-1439px | Small laptops, landscape tablets | Multi-column layouts, full navigation, desktop UI patterns | | **XL** | 1440px+ | Desktop monitors, large screens | Max-width containers, multi-panel layouts, advanced features visible | **Mobile Simplification Examples:** - **Navigation**: Hamburger menu (mobile) → Full nav bar (desktop) - **Forms**: Stacked fields (mobile) → Side-by-side fields (desktop) - **Content**: Single column (mobile) → Multi-column grid (desktop) - **Actions**: Fixed bottom bar (mobile) → Inline buttons (desktop) - **Tables**: Collapsed cards (mobile) → Full data table (desktop) - **Sidebars**: Hidden/collapsible (mobile) → Always visible (desktop) - **Filters**: Modal/drawer (mobile) → Sidebar panel (desktop) ### Tailwind Responsive Classes ```tsx
Responsive width
``` ## Responsive Images ### Using srcset for Responsive Images ```tsx Descriptive alt text ``` ### Next.js Image Component ```tsx import Image from 'next/image'; Descriptive alt text ``` ## Responsive Typography ### Fluid Typography with Tailwind ```tsx

Responsive Headline

``` ### Fluid Typography with CSS Clamp ```css h1 { /* min: 2rem (32px), preferred: 5vw, max: 4rem (64px) */ font-size: clamp(2rem, 5vw, 4rem); line-height: 1.2; } p { /* min: 1rem (16px), preferred: 2.5vw, max: 1.25rem (20px) */ font-size: clamp(1rem, 2.5vw, 1.25rem); line-height: 1.6; } ``` ## Responsive Layouts ### CSS Grid Responsive Pattern ```tsx
{items.map(item => ( {item.content} ))}
``` ### Flexbox Responsive Pattern ```tsx
Content Left
Content Right
``` ## Touch-Friendly Interfaces ### Touch Target Sizing ```tsx // Minimum 44x44px touch targets ``` ### Touch Gestures ```tsx // Consider common mobile gestures
{/* Scrollable content */}
``` ## Navigation Patterns ### Mobile Menu Pattern ```tsx import { useState } from 'react'; import { List, X } from '@phosphor-icons/react'; export function MobileNav() { const [isOpen, setIsOpen] = useState(false); return ( <> {/* Mobile menu button */} {/* Mobile menu overlay */} {isOpen && (
)} {/* Desktop navigation */} ); } ``` ### Sticky Navigation ```tsx
``` ## Responsive Forms ### Form Layout Pattern ```tsx
{/* Full width on mobile, side-by-side on desktop */}
{/* Full width textarea */}