# Notifications list

Recent events, newest first, each a linked sentence with the time it happened.

**Our choice:** A composition, not a component: a `data-card` section holding an ordered `.stack` list, each item one paragraph with a link and a small muted `<time>`.

_Diagram: A notifications list sits in a card in the content area, newest first, each item a linked sentence with its time below._

## Live example

### Notifications list

```html
<section data-card aria-labelledby="inbox-title">
  <h3 id="inbox-title">Notifications</h3>
  <ol class="stack">
    <li>
      <p>
        <a href="#inv-0318">Analytical Engines Ltd. paid INV-2025-0318</a><br>
        <span data-text="small muted"><time datetime="2026-11-27T09:12">Today, 9:12</time></span>
      </p>
    </li>
    <li>
      <p>
        <a href="#inv-0316">INV-2025-0316 is 60 days overdue</a> <span data-badge="warning">Overdue</span><br>
        <span data-text="small muted"><time datetime="2026-11-26T16:40">Yesterday, 16:40</time></span>
      </p>
    </li>
    <li>
      <p>
        <a href="#team">Amara Okafor accepted your invitation</a><br>
        <span data-text="small muted"><time datetime="2026-11-24T11:05">Monday, 11:05</time></span>
      </p>
    </li>
  </ol>
  <footer>
    <a href="#all-notifications">See all notifications</a>
  </footer>
</section>
```

## Accessibility

- An ordered list, because the order (newest first) means something.
- Each link says what happened, so it makes sense out of context ([WCAG 2.4.4](https://www.w3.org/WAI/WCAG22/Understanding/link-purpose-in-context.html)). `<time datetime>` gives the machine-readable moment.
- A notification that arrives while the page is open is a status message: announce it with a [toast](https://github.com/odonckers/domestic-ui/blob/main/alerts.html), and add it to this list.

## Specifications

- [HTML `<ol>` element](https://html.spec.whatwg.org/multipage/grouping-content.html#the-ol-element)
- [HTML `<time>` element](https://html.spec.whatwg.org/multipage/text-level-semantics.html#the-time-element)
- [WCAG 2.4.4 Link Purpose (In Context)](https://www.w3.org/WAI/WCAG22/Understanding/link-purpose-in-context.html)

## See also

- [Molecules](https://domestic-ui.odonckers.dev/molecules/index.md)
- Source: [`examples/patterns/compositions.html`](https://github.com/odonckers/domestic-ui/blob/main/examples/patterns/compositions.html)

## How other systems do it

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

- [Apple Human Interface Guidelines: Notifications](https://developer.apple.com/design/human-interface-guidelines/notifications)
- [Material Design 3: Lists](https://m3.material.io/components/lists/overview)
- Vercel Geist: No equivalent
