# Responsive layout

Four breakpoints are minimum widths: `sm` 40rem, `md` 48rem, `lg` 64rem and `xl` 80rem. They are rems, so they follow the reader’s font size.

## Responsive props

Every Box layout prop, and the props of Stack, Grid and the components built on Box, takes either a value or an object keyed by breakpoint. `base` applies everywhere; each breakpoint applies from that width up. The classes are generated at build time, so this works on the server with no JavaScript.

**Example: Responsive props** (`examples/foundations/responsive-props.tsx`)

```tsx
import { Box, Grid, Stack } from '@blocks/design-system'

export default function ResponsiveProps() {
  return (
    <Stack gap={{ base: 'sm', md: 'lg' }}>
      <Box padding={{ base: 'sm', md: 'lg' }} border="default" textAlign={{ base: 'left', md: 'center' }}>
        Padding and alignment change at md (48rem).
      </Box>
      <Grid columns={{ base: 1, sm: 2, lg: 4 }} gap="sm" aria-label="Readings">
        {['Depth', 'New snow', 'Wind', 'Temperature'].map((label) => (
          <Box key={label} padding="sm" backgroundColor="surface">
            {label}
          </Box>
        ))}
      </Grid>
    </Stack>
  )
}
```

## Media queries in your CSS

The package’s own CSS writes `@media (--ds-md)` and expands it at build time. In your CSS, use the same widths: `@media (width >= 48rem)`. The values are also available as `tokens.breakpoints` from `@blocks/design-system/tokens`.

## Reading order

Responsive props change the visual arrangement only. Keep the source order meaningful, since screen readers and the Tab key follow it, and avoid reversed directions for content people read.
