Responsive Design
Eidetic uses a mobile-first approach with Tailwind CSS breakpoints. All components are designed to work seamlessly across devices from mobile phones to large desktop monitors.
Mobile
< 640px
Default (no prefix)
Tablet
640px+
sm:
Tablet (lg)
768px+
md:
Desktop
1024px+
lg:
Breakpoint Reference
Tailwind CSS v4 breakpoints used throughout Eidetic components.
| Breakpoint | Min Width | CSS | Typical Devices |
|---|---|---|---|
default | 0px | @media (min-width: 0px) | All devices (mobile-first) |
sm: | 640px | @media (min-width: 640px) | Large phones, small tablets |
md: | 768px | @media (min-width: 768px) | Tablets (portrait) |
lg: | 1024px | @media (min-width: 1024px) | Tablets (landscape), laptops |
xl: | 1280px | @media (min-width: 1280px) | Desktops |
2xl: | 1536px | @media (min-width: 1536px) | Large desktops, monitors |
Mobile-First Approach
Always start with mobile styles and add responsive prefixes for larger screens.
Correct: Mobile-First
{/* Start with mobile, add larger screen overrides */}<div className=" flex flex-col {/* Mobile: stack vertically */} md:flex-row {/* Tablet+: horizontal row */} gap-4 {/* Mobile: 16px gap */} md:gap-6 {/* Tablet+: 24px gap */}"> <div className="w-full md:w-1/3">Sidebar</div> <div className="w-full md:w-2/3">Content</div></div>✕Incorrect: Desktop-First
{/* Don't do this - starts with desktop, overrides for mobile */}<div className=" flex-row {/* Assumes desktop */} sm:flex-col {/* Tries to fix for mobile - backwards! */}"> ...</div>Responsive Grid Layouts
Common grid patterns that adapt from mobile to desktop.
Card Grid (1 → 2 → 3 → 4 columns)
<div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4"> <Card>...</Card> <Card>...</Card> <Card>...</Card> <Card>...</Card></div>Sidebar + Content Layout
<div className="flex flex-col md:flex-row gap-4"> <aside className="w-full md:w-64 shrink-0"> Sidebar </aside> <main className="flex-1"> Main Content </main></div>Form Fields (Stacked → Inline)
<div className="grid grid-cols-1 md:grid-cols-2 gap-4"> <div> <Label>First Name</Label> <Input placeholder="John" /> </div> <div> <Label>Last Name</Label> <Input placeholder="Doe" /> </div></div>Responsive Typography
Scale text sizes across breakpoints for optimal readability.
Responsive Heading
This paragraph scales from small on mobile to large on desktop, ensuring comfortable reading across all devices.
{/* Heading scales: 24px → 30px → 36px → 48px */}<h1 className="text-2xl sm:text-3xl md:text-4xl lg:text-5xl font-bold"> Responsive Heading</h1>
{/* Body text scales: 14px → 16px → 18px */}<p className="text-sm sm:text-base md:text-lg"> Paragraph text...</p>Responsive Spacing
Adjust padding and margins based on screen size.
This box has responsive padding: 16px → 24px → 32px → 48px
<div className="p-4 sm:p-6 md:p-8 lg:p-12"> Content with responsive padding</div>
{/* Common responsive spacing patterns */}<section className="py-8 md:py-12 lg:py-16"> {/* Vertical sections */}<div className="px-4 sm:px-6 lg:px-8"> {/* Container padding */}<div className="space-y-4 md:space-y-6"> {/* Stacked elements */}<div className="gap-4 md:gap-6 lg:gap-8"> {/* Grid/flex gaps */}Responsive Visibility
Show or hide elements based on screen size.
{/* Show only on mobile */}<div className="block sm:hidden">Mobile menu</div>
{/* Show only on tablet (640-768px) */}<div className="hidden sm:block md:hidden">Tablet content</div>
{/* Show only on desktop (768px+) */}<div className="hidden md:block">Desktop navigation</div>
{/* Hide on mobile, show on tablet+ */}<div className="hidden sm:flex">...</div>
{/* Show on mobile, hide on desktop */}<div className="flex lg:hidden">...</div>Touch Target Sizes
Ensure interactive elements are large enough for touch input on mobile devices.
- Minimum 44x44px: WCAG recommends minimum touch targets of 44x44 CSS pixels for accessibility
- Adequate Spacing: Maintain at least 8px spacing between touch targets to prevent accidental taps
- Finger-Friendly: Buttons and links should be easy to tap without zooming on mobile
- Hit Areas: Use padding to increase hit areas even if visual size is smaller
Button Size Examples
{/* One scale for every control: 32, 40 and 48px. All meet WCAG 2.5.8 (24px minimum). */}<Button size="sm">Small</Button> {/* h-8 (32px), dense toolbars */}<Button size="md">Default</Button> {/* h-10 (40px), default */}<Button size="lg">Large</Button> {/* h-12 (48px), touch-first screens */}
{/* Increase hit area with padding */}<button className="p-3 -m-3"> {/* Visual 24px, hit area 48px */} <Icon className="w-6 h-6" /></button>Container Queries (CSS)
Style elements based on container size instead of viewport for reusable components.
Container queries allow components to adapt based on their container width, making them more reusable across different layouts.
/* Define a container */.card-container { container-type: inline-size; container-name: card;}
/* Style based on container width */@container card (min-width: 400px) { .card-content { display: grid; grid-template-columns: 1fr 1fr; }}
/* Tailwind CSS v4 container query classes */<div className="@container"> <div className="@sm:grid @sm:grid-cols-2"> Content adapts to container size </div></div>Best Practices
Guidelines for building responsive interfaces with Eidetic.
Do
- Start with mobile styles, add breakpoint overrides
- Test on real devices, not just browser resize
- Use relative units (rem, %) over fixed pixels
- Ensure 44px minimum touch targets on mobile
- Use flexbox/grid for fluid layouts
✕Avoid
- Fixed widths that break on small screens
- Hiding essential content on mobile
- Horizontal scrolling (except for tables/carousels)
- Tiny touch targets under 44px
- Desktop-first CSS that needs mobile overrides
Testing Responsive Designs
Browser DevTools
- Chrome DevTools Device Mode (Cmd/Ctrl + Shift + M)
- Firefox Responsive Design Mode
- Safari Responsive Design Mode
Real Device Testing
- BrowserStack - Cross-browser testing
- Physical devices - iPhone, Android, tablets
- Xcode Simulator / Android Emulator