Responsive & dark mode

Craft layouts that adapt cleanly across desktop, phone, and foldable screens while delivering crisp light and dark themes with zero contrast regressions.

Mobile-first fluidity plus theme parity

Great responsive design is not shrinking a 1440px laptop page until everything turns microscopic. Likewise, great dark mode is not inverting white backgrounds into stark #000000 black with harsh neon text.

Both depend on the same foundation: fluid layout primitives paired with semantic surface tokens. When layouts adapt cleanly across breakpoints and themes switch via shared CSS variables, your app feels native on desktops, Android phones installed via QR code, iPhones added via Safari Add to Home Screen, and foldables.

You can audit both dimensions inside Browser Device Lab before publishing any update to Live.

Breakpoint strategy across phones, foldables, and desktops

Plan across four real-world viewport ranges instead of a rigid phone-versus-desktop split so unfolded foldables and compact laptops never look stretched.

Viewport rangeDevicesNavigation patternLayout & gridKey edge cases
Compact (`< 380px`)Folded cover screens, small phonesTop bar + slide-over drawer or 4-item bottom tabsStrict 1-column stack with 16px guttersWrapped CTA labels, narrow cards, badge collisions
Mobile (`390px–430px`)Pixel, Galaxy, standard & Pro Max iPhonesApp: bottom tabs; Web: minimal header + drawer1-column forms, stacked cards, scrollable tables>= 16px inputs (prevents iOS zoom), safe-area padding
Intermediate (`670px–1024px`)Unfolded foldables, tabletsCompact top nav or collapsible sidebarBalanced 2-column grids; split detail panelsStretched narrow text or oversized full-width buttons
Desktop (`1200px+`)Laptops & wide monitorsFull top bar or persistent left sidebar3–4 column grids capped at 1200px–1280pxRunaway text lines (> 75ch) and sparse edges

Engineering crisp dark mode without contrast bugs

Reliable dark mode requires deliberate token hierarchy rather than automatic color inversion.

Build dark surfaces by elevation, not pure black

Pure #000000 backgrounds paired with #FFFFFF ink create harsh optical glare during reading. Anchor your dark canvas in deep slate or charcoal (#0E1116), lift cards and modals one subtle step lighter (#161B22, #1E2530), and define structure with whisper translucent hairlines (rgba(255, 255, 255, 0.11)).

Tune accents and ink for WCAG contrast

A deep forest green or navy accent that reads sharply on warm white often turns muddy on dark slate. Lighten dark-mode accents slightly so buttons, links, active tabs, and charts keep >= 4.5:1 text contrast and >= 3:1 control contrast. Pair them with calm off-white body ink (#F3F4F6) and legible muted grey (#9AA4B2).

Support system preference with zero white flash

Provide a simple Light / Dark / System control that honors prefers-color-scheme, saves explicit choices locally, and applies the theme attribute before initial paint so reloading in dark mode never flashes bright white.

css
:root {
  --bg-canvas: #faf9f6;
  --bg-surface: #ffffff;
  --border-hairline: rgba(17, 24, 39, 0.10);
  --ink-primary: #14171a;
  --ink-muted: #5b6470;
  --accent: #1d5b49;
  --accent-ink: #ffffff;
}

[data-theme="dark"] {
  --bg-canvas: #0e1116;
  --bg-surface: #161b22;
  --border-hairline: rgba(255, 255, 255, 0.11);
  --ink-primary: #f3f4f6;
  --ink-muted: #9aa4b2;
  --accent: #38a885;
  --accent-ink: #071912;
}

High-impact responsive patterns for real apps

Full-stack business apps tend to break in three predictable areas on small screens unless designed deliberately.

Data tables and pricing matrices

A six-column /admin/orders table cannot compress onto a 390px phone cleanly. Use one of two proven patterns:

  • Stacked summary cards below `768px`. Turn each row into a compact card showing name, status, amount, and primary button while revealing full metadata on tap.
  • Scoped horizontal scroll wrapper. For pricing feature grids or ledgers, wrap the table inside an overflow-x: auto container with a sticky first column so the page itself never scrolls sideways.

Safe areas, dynamic viewport height, and tap targets

Mobile browser address bars expand and shrink during scrolling, and bottom gesture bars overlap fixed footers:

  • Use 100dvh instead of rigid 100vh on full-screen modals and drawers so submit buttons stay reachable.
  • Apply env(safe-area-inset-bottom) on fixed bottom tabs and checkout bars, plus matching bottom padding on scrollable pages.
  • Keep mobile inputs >= 16px font size (avoiding involuntary iOS Safari auto-zoom) and touch targets at least 44×44px.

Logos and screenshots across themes

A black logo vanishes on charcoal headers. Use monochrome currentColor SVGs or pair explicit light and dark logo files. Give bright product screenshots a crisp 1px border hairline in dark mode so images sit cleanly inside the frame.

Step-by-step responsive and theme QA workflow

Walk through this focused audit inside Browser Device Lab before clicking Publish or exporting a Google Play .aab bundle.

  1. Verify shared theme tokens

    Confirm pages, cards, inputs, modals, and toasts read CSS variables instead of hardcoded #ffffff or #000000 colors.

  2. Walk primary flows on phone profiles

    Switch Browser Device Lab to Pixel and iPhone frames and test navigation, forms, and checkout in Light mode for overflow or clipped controls.

  3. Check unfolded foldable proportions

    Switch to an unfolded foldable frame and confirm grids shift cleanly into 2 columns rather than stretching narrow cards.

  4. Flip to Dark mode and re-audit

    Verify logos, muted placeholders, badges, focus rings, and Stripe buttons stay sharp on both desktop and mobile viewports.

  5. Reload in Dark mode

    Refresh Preview to confirm the preference persists instantly without a brief white flash.

Add complete Light, Dark, and System theme parity cleanly to an existing app:

Starter prompt · App

Implement Light, Dark, and System theme support across all screens using semantic CSS variables. Use a deep charcoal canvas (#0E1116), stepped lighter cards (#161B22), subtle translucent borders, off-white primary text, and contrast-verified dark accents. Add a clean theme switcher in Account settings and the header menu, persist choices across reloads with zero white flash, and ensure logos and form inputs stay sharp in both themes.

Run a combined responsive and dark-mode hardening pass across a public site or storefront:

Starter prompt · Web

Audit responsive layouts and Dark mode contrast across the homepage, pricing page, and checkout drawer for 360px phones, standard iPhones, unfolded foldables (720px), and 1440px desktops. Remove all horizontal page overflow, stack pricing tiers on phones and show 2 columns on foldables, keep form inputs >= 16px, add safe-area bottom clearance to sticky mobile CTAs, and verify badge and caption contrast in both themes.

Common responsive and dark mode bugs

Resolve frequent multi-device and theme regressions quickly using this diagnostic table.

SymptomRoot causeClean fix
Mobile page wiggles sideways while scrollingA wide table, fixed-pixel box, or unbroken string exceeds screen widthWrap wide tables in overflow-x: auto, enable break-words, and remove fixed widths
Brief white flash when reloading in Dark modeTheme attribute applies only after client scripts hydrateSet the saved theme attribute via a tiny synchronous head script before first paint
Header logo vanishes in Dark modeFixed black SVG or dark raster PNG placed over dark headerSwitch to currentColor SVG or pair dedicated light and dark logo files
Inputs render as glaring white boxes in Dark modeInputs kept browser default backgrounds instead of theme tokensBind input background, border, text, and placeholder to dark CSS variables
iPhone zooms into checkout when tapping a fieldInput font size is smaller than 16px on mobileSet all mobile text, email, and select inputs to at least 16px
Sticky mobile CTA covers the last list itemFixed bottom bar overlaps scroll container without clearanceAdd bottom page padding matching bar height plus env(safe-area-inset-bottom)

Next steps

Still have a question?Ask our team and other builders on Discord.

From the blog