# Typography

Font, text layout, and text color.

Source: https://www.zazz.sh/api/utilities/typography/

Reach for a role first (`data-ui="text-lg"`, native headings), then override one property with a utility. `--font-weight` takes a number or the role weights `strong`, `heading`, and `body`; standard names such as `medium` are not CSS, so write `500`. Text color is `--text`, with state tiers.

`--text-wrap: truncate` keeps text on one line and ends the overflow with an ellipsis. It needs a width to overflow: a block element, a sized one (`--w: 48`), or a flex item with `--min-w: 0`, since a flex item can't shrink below its content otherwise. `none` means plain wrapping, so `--text-wrap: truncate; --text-wrap--md: none` wraps from `md` up. It takes breakpoints and states. It beats a primitive's own overflow while active, a tier with any other value hands that back, and `--overflow` wins over it. The exception is `--stuck`: another value there changes the wrapping but keeps the clip. A multi-word value like `wrap balance` isn't supported. To clamp to more than one line, use `--line-clamp`.

```html
<p style="--text-wrap: truncate">A file name far too long for its column.pdf</p>
```

## Reference

| Utility | Writes | Value | Tiers | Notes |
| --- | --- | --- | --- | --- |
| `--font-family` | `font-family` | any CSS value | — |  |
| `--font-size` | `font-size` | any CSS value | breakpoints | `--before-font-size` / `--after-font-size` |
| `--font-weight` | `font-weight` | number, or strong / heading / body (the role weight tokens) | breakpoints | keywords: `heading`, `body`, `strong`; `--before-font-weight` / `--after-font-weight` |
| `--font-style` | `font-style` | keyword | — |  |
| `--leading` | `line-height` | any CSS value | breakpoints |  |
| `--tracking` | `letter-spacing` | any CSS value | breakpoints |  |
| `--line-clamp` | `-webkit-line-clamp` | line count (1 truncates) | breakpoints |  |
| `--text-align` | `text-align` | keyword | breakpoints | works tier-only |
| `--text-decoration` | `text-decoration-line` | any CSS value | breakpoints, states | works tier-only |
| `--text-transform` | `text-transform` | keyword | breakpoints |  |
| `--text-wrap` | `text-wrap` | keyword, plus truncate (one line, ellipsis) and none (wraps normally) | breakpoints, states | works tier-only |
| `--whitespace` | `white-space` | keyword | breakpoints |  |
| `--text` | `color` | any CSS value | breakpoints, states | `--before-text` / `--after-text` |
