Docs

Main site

Installation Browser support Extend config MCP server
Validation Page speed testing Responsive design
Accordion Aspect Ratio Avatar Badge Banner Bento Grid Blockquote Breadcrumbs Button Callout Card Drawer Dropdown Link Modal Navbar Navblock Pagination Popover Progress Separator Tabs Timeline Toast Tooltip
Checkbox Datepicker File upload Form field Input Label OTP Radio Range Select Textarea Toggle
Header Footer
Accordion Auth Checkbox & Radio Content Drawers Features Modals Statistics & Metrics Teams Dropdowns
Address Contact number Currency symbol Date Emirates ID Name
Close
Home Documentation Concepts Responsive design

Responsive design

How the UAE Design System adapts to every screen size: its breakpoints, the components whose props respond to the viewport, and how to build and test layouts that work on phones, tablets and desktops, in English and Arabic.

Mobile first

The design system is mobile first, like Tailwind CSS. A utility without a prefix applies at every screen size. A prefixed utility such as md: applies from that breakpoint upwards. Design the smallest screen first, then add prefixes as the layout gains space.

<!-- One column on phones, two from 768px, four from 1024px -->
<div class="grid grid-cols-1 gap-4 md:grid-cols-2 lg:grid-cols-4">
  …
</div>

Many people using government services reach them on a phone, often over a mobile network. Starting from the small screen keeps the essential task in front of them and stops desktop-only content from leaking into the mobile layout.

Breakpoints

The theme (@aegov/designsystem/theme) defines six breakpoints. xs is added by the design system; the others match Tailwind's defaults.

Prefix Minimum width Typical screens
xs: 480px Large phones
sm: 640px Large phones in landscape, small tablets
md: 768px Tablets in portrait
lg: 1024px Tablets in landscape, small laptops
xl: 1280px Laptops and desktops
2xl: 1536px Large desktops

To target a range, combine a breakpoint with a max-* variant. md:max-lg: applies from 768px up to, but not including, 1024px:

<p class="hidden md:max-lg:block">Shown on tablets in portrait only.</p>

Choose breakpoints by where your content breaks, not by device names. Widen the browser slowly and add a breakpoint where a line gets too long or a layout starts to look stretched.

Responsive component props

Some components accept a responsive string in a prop, using the same breakpoint prefixes as Tailwind utilities. The component resolves the value against the current viewport width and updates it when the window is resized.

<aegov-callout size="sm xl:lg">…</aegov-callout>

<aegov-bento-grid cols="1 md:2 lg:4" gap="sm lg:lg">
  <aegov-card data-col-span="1 md:2">…</aegov-card>
  …
</aegov-bento-grid>
Component Responsive props
aegov-aspect-ratio ratio
aegov-banner size
aegov-bento-grid cols, gap
aegov-callout size
aegov-card data-col-span (inside a bento grid)
aegov-link size
aegov-navbar, aegov-navbar-item size
aegov-navblock size

Any other prop takes a single value. For example, aegov-card's size is fixed, so its padding and radius do not change with the viewport.

Responsive props read the breakpoint values from the --breakpoint-* custom properties that the theme declares on :root. Keep the theme import in your stylesheet: without it, a prefixed value such as md:base never matches.

Utilities on components

Most components render inside a shadow root, which normally keeps your page's CSS out. Margin and padding utilities passed through extra-class, including responsive ones such as md:px-6, are copied in at runtime and work as expected. Other utilities (colour, border, typography) passed that way have no effect.

To change how a component is laid out at different sizes, put responsive utilities on a wrapper element around it, or use a responsive prop where the component offers one.

<div class="w-full md:w-1/2">
  <aegov-input name="email" type="email" extra-class="mt-4 md:mt-6"></aegov-input>
</div>

Container queries

Breakpoints respond to the width of the window. A card in a narrow sidebar and the same card in the main column need different layouts at the same window width. For those cases, use Tailwind's container queries: mark the parent with @container and use @sm:, @md: and the other container variants on its children.

<div class="@container">
  <div class="flex flex-col gap-4 @md:flex-row">
    …
  </div>
</div>

The children now respond to the width of their container, wherever it is placed on the page.

Right-to-left layouts

A responsive layout must also work in Arabic. Use logical utilities, which follow the reading direction, instead of physical left and right:

Use Instead of
ms-*, me-* ml-*, mr-*
ps-*, pe-* pl-*, pr-*
start-*, end-* left-*, right-*
text-start, text-end text-left, text-right
rounded-s-*, rounded-e-* rounded-l-*, rounded-r-*

With dir="rtl" on the <html> element, the whole layout flips at every breakpoint without separate Arabic styles. Check every breakpoint in both directions: a layout that fits in English can wrap differently in Arabic, where words are often longer.

Zoom, reflow and touch

Responsive design is also an accessibility requirement under WCAG 2.2:

  • Reflow (1.4.10). Content must fit a width of 320 CSS pixels without scrolling in two directions. This is the same as zooming a 1280px-wide window to 400%. Data tables, maps and diagrams are exempt.
  • Resize text (1.4.4). Text must stay readable and usable at 200% zoom.
  • Target size (2.5.8). Interactive targets must be at least 24 × 24 CSS pixels, or spaced so that a 24px circle on each does not overlap another target.
  • Orientation (1.3.4). Do not lock the page to portrait or landscape.

Include the standard viewport meta tag, and never disable zoom with maximum-scale=1 or user-scalable=no:

<meta name="viewport" content="width=device-width, initial-scale=1">

Testing responsive layouts

  1. Open the browser's device toolbar (Chrome and Edge: Ctrl+Shift+M, or Cmd+Shift+M on macOS) and drag the width slowly from 320px to beyond 1536px. Watch for overflow, clipped text and awkward line lengths.
  2. Check each side of every breakpoint you use, such as 767px and 768px. Most layout bugs appear right at the edge.
  3. Repeat with dir="rtl" and Arabic content.
  4. Zoom to 200% and 400% on a desktop-sized window.
  5. Test on at least one real Android phone and one real iPhone. Emulators do not show touch accuracy, on-screen keyboards or real network speed.

For spacing, grids and page widths, follow the Layout and spacing guideline.

Where to next

Page speed testing Back to Concepts