Skip to main content

Responsive design

Build layouts that read well from a 375px phone up to a 4K monitor. Aidash Components inherits Tailwind's mobile-first breakpoints — nothing new to learn.

Mobile first
Write the smallest layout first, then add prefixes (sm:, md:,lg:) to enlarge it. It reads more naturally and produces less overall CSS.

Breakpoints

Five standard breakpoints. All are min-width — i.e. the class applies at that width and larger.

Prefixmin-widthTypical devices
sm:640pxLarge phones · Small tablets
md:768pxTablets · Landscape phones
lg:1024pxLaptops · Small desktops
xl:1280pxDesktops
2xl:1536pxLarge desktops

Container queries

Tailwind v4 supports @container out of the box. Great for components that need to respond to their parent, not the viewport.

card.tsx
tsx
<div className="@container">
  <div className="@md:grid @md:grid-cols-2 gap-4">
    <img src="/cover.jpg" alt="" />
    <div>
      <h3>Title</h3>
      <p>Body...</p>
    </div>
  </div>
</div>

Fluid typography

Use clamp() to interpolate font-size smoothly between two viewport widths. Avoid step-y resizing at breakpoints.

app/globals.css
css
.hero-title {
  font-size: clamp(1.875rem, 1.5rem + 1.5vw, 3rem);
  line-height: 1.1;
}
Info
The h1 in every Aidash docs page uses this exact pattern — smooth from 30px on mobile up to 36px on desktop.

Layout patterns

Two grid patterns that cover 90% of what you'll build.

Auto-fit card grid

A grid that reflows automatically — no breakpoint prefixes needed. Cards shrink from three columns down to one as the viewport narrows.

grid.tsx
tsx
<div className="grid grid-cols-[repeat(auto-fit,minmax(220px,1fr))] gap-4">
  {items.map(item => <Card key={item.id} {...item} />)}
</div>

Sidebar + main

Sidebar hides below md, main content expands. A single grid keeps sticky positioning simple.

layout.tsx
tsx
<div className="md:grid md:grid-cols-[240px_1fr] md:gap-6">
  <aside className="hidden md:block">
    <Sidebar />
  </aside>
  <main>{children}</main>
</div>

Testing responsive layouts

Ways to catch broken layouts before your users do.

Zoom to 200%
WCAG says a site must remain usable at 200% zoom. Try it — that's where hardcoded heights and overflow bugs show up.
Rotate on device
Landscape phones are the most-overlooked viewport. If you build once and never rotate, you'll ship broken.
DevTools device toolbar
Chrome, Firefox, and Safari all ship a device toolbar. Add custom viewports for the odd sizes your users actually run (iPad Mini, 32-inch ultrawide).

Also see