# Text helpers

Lead, small and muted text helpers from domestic-ui, with copyable markup.

_Diagram: The lead paragraph sits right under a page's heading in larger text, and small muted text holds metadata such as a last-updated line at the end._

## Live example

### Lead paragraph

```html
<p data-text="lead">Plan your week in five minutes. Everything else stays out of the way.</p>
<p>Regular body text follows at the normal size.</p>
```

### Small and muted

```html
<p data-text="small">Prices include tax.</p>
<p data-text="muted">Shared with 3 people.</p>
<p data-text="small muted">Last updated <time datetime="2026-05-03">3 May 2026</time>.</p>
```

## Attributes

`data-text="lead | small | muted"` (combinable)

| Attribute or value | Effect |
| --- | --- |
| `data-text="lead \| small \| muted"` |  |

Values are a space-separated list, so they combine: `data-text="small muted"`.

- Values combine: `data-text="small muted"`.
- Size and color only. For meaning, use [`<small>`](https://html.spec.whatwg.org/multipage/text-level-semantics.html#the-small-element), `<strong>` or `<em>`.

## Accessibility

- Muted text uses `--dui-color-text-muted`, tested at 4.5:1 on every surface ([WCAG 1.4.3](https://www.w3.org/WAI/WCAG22/Understanding/contrast-minimum.html)).

## Specifications

- [WHATWG text-level semantics](https://html.spec.whatwg.org/multipage/text-level-semantics.html)
- [WCAG 1.4.3](https://www.w3.org/WAI/WCAG22/Understanding/contrast-minimum.html)
- [WHATWG the small element](https://html.spec.whatwg.org/multipage/text-level-semantics.html#the-small-element)

## See also

- [Atoms](https://domestic-ui.odonckers.dev/atoms/index.md)
- [Component API convention](https://domestic-ui.odonckers.dev/index.md#component-api)
- [Accessibility baseline](https://domestic-ui.odonckers.dev/principles/accessibility-baseline-wcag-22-aa.md)
- Source: [`css/components/atoms/text.css`](https://github.com/odonckers/domestic-ui/blob/main/css/components/atoms/text.css), [`examples/atoms/text.html`](https://github.com/odonckers/domestic-ui/blob/main/examples/atoms/text.html)

## How other systems do it

For comparison only; these are not the standard this system follows.

- [Apple Human Interface Guidelines: Typography](https://developer.apple.com/design/human-interface-guidelines/typography)
- [Material Design 3: Typography](https://m3.material.io/styles/typography/overview)
- [Vercel Geist: Typography](https://vercel.com/geist/typography)
