# Measure

Caps text at a readable line length, roughly 45 to 80 characters, and centers it. Use it around articles, guides and long form fields; layout components take the full width.

```tsx
import { Measure } from '@blocks/design-system'
```

## Usage

Wrap long text. Measure renders a `<div>` unless you pass `as`, so an article can be the Measure itself.

**Example: Field notes** (`examples/measure/field-notes.tsx`)

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

export default function FieldNotes() {
  return (
    <Measure as="article" size="md" aria-labelledby="field-notes-title">
      <Box as="h3" id="field-notes-title" marginTop="none">
        Reading a snow course
      </Box>
      <p>
        A snow course is a line of marked points where observers measure depth and water content by hand. The same
        points are sampled near the first of each month, so a season’s readings can be compared with decades of earlier
        ones without worrying that the observer chose easier ground.
      </p>
      <p>
        Automated stations report every hour, which makes them better for storms and melt, but a single sensor can be
        fooled by drifting. When the two disagree, the manual course is usually the better guide to how much water the
        basin holds, and the station is the better guide to when it changed.
      </p>
      <a href="#next-reading">Next: comparing seasons</a>
    </Measure>
  )
}
```

## Sizes

`size` takes a measure token: `sm` (26rem), `md` (38rem, the default) or `lg` (46rem). The tokens are rems rather than `ch`, so a line doesn’t change length when a web font replaces the fallback. On a screen narrower than the measure, Measure is simply the full width. Pass `marginX="none"` to align it to the start instead of centering.

**Example: Measure sizes** (`examples/measure/sizes.tsx`)

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

export default function Sizes() {
  return (
    <Stack gap="sm">
      {(['sm', 'md', 'lg'] as const).map((size) => (
        <Measure key={size} size={size} marginX="none">
          <Box padding="xs" border="default" backgroundColor="bg-subtle">
            size="{size}"
          </Box>
        </Measure>
      ))}
    </Stack>
  )
}
```

## Props

**`Measure` props**

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `as` | `ElementType` | — | The element or component to render, e.g. `as={NextLink}`. |
| `size` | `"sm" \| "md" \| "lg"` | `md` | A measure token: `sm` (26rem), `md` (38rem) or `lg` (46rem). Defaults to `"md"`. |

Also accepts [Box layout props](https://design-system.blocks-ui.com/components/box.md#props), [styling escape hatches](https://design-system.blocks-ui.com/components/box.md#escape-hatches), [margin props](https://design-system.blocks-ui.com/components/box.md#spacing) and [padding props](https://design-system.blocks-ui.com/components/box.md#spacing), and the native attributes of the element it renders.

## Accessibility

- Short lines are easier to track from one line to the next, especially when text is enlarged.
- Measure sets only a maximum width, so text still reflows when zoomed.
