# People list

A list of people, each with a name, an email and a role badge at the end of the row.

**Our choice:** A composition, not a component: a `.stack` list whose items are `.cluster` rows with `--cluster-justify: space-between`, the name in `<strong>` above a small muted email.

_Diagram: A people list sits in a card in the content area, one row per person with their name and email and a role badge at the end._

## Live example

### People list

```html
<section data-card aria-labelledby="team-title">
  <h3 id="team-title">Team</h3>
  <ul class="stack">
    <li class="cluster" style="--cluster-justify: space-between">
      <p>
        <strong>Maria Santos</strong><br>
        <span data-text="small muted">maria@northwind.example</span>
      </p>
      <span data-badge>Owner</span>
    </li>
    <li class="cluster" style="--cluster-justify: space-between">
      <p>
        <strong>Kenji Watanabe</strong><br>
        <span data-text="small muted">kenji@northwind.example</span>
      </p>
      <span data-badge>Admin</span>
    </li>
    <li class="cluster" style="--cluster-justify: space-between">
      <p>
        <strong>Amara Okafor</strong><br>
        <span data-text="small muted">amara@northwind.example</span>
      </p>
      <span data-badge="accent">Invited</span>
    </li>
  </ul>
</section>
```

## Accessibility

- The role is text in a badge, never a colour alone ([WCAG 1.4.1](https://www.w3.org/WAI/WCAG22/Understanding/use-of-color.html)).
- When people need sorting, filtering or bulk actions, use a [data table](https://github.com/odonckers/domestic-ui/blob/main/data-table.html) instead.

## Specifications

- [HTML `<ul>` element](https://html.spec.whatwg.org/multipage/grouping-content.html#the-ul-element)
- [WCAG 1.4.1 Use of Color](https://www.w3.org/WAI/WCAG22/Understanding/use-of-color.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: Lists and tables](https://developer.apple.com/design/human-interface-guidelines/lists-and-tables)
- [Material Design 3: Lists](https://m3.material.io/components/lists/overview)
- Vercel Geist: No equivalent
