# List

Structured lists with titles and descriptions. (CSS only.)

Reference: https://timeless.build/docs/components/list/

## Markup

```html
<ul class="ui-list">
  <li data-ui-part="item">
    <span data-ui-part="title">Install package CSS</span>
    <span data-ui-part="description">Import tokens and only the components you use.</span>
  </li>
  <li data-ui-part="item">
    <span data-ui-part="title">Author native markup</span>
    <span data-ui-part="description">Keep behavior available when CSS is absent.</span>
  </li>
  <li data-ui-part="item">
    <span data-ui-part="title">Style public anatomy</span>
    <span data-ui-part="description">Use class hooks and namespaced data attributes.</span>
  </li>
</ul>
```

## Install

```js
import '@timelessui/components/css/tokens.css'
import '@timelessui/components/css/core/list.css'
import '@timelessui/components/css/themes/atmosphere/tokens.css'
import '@timelessui/components/css/themes/atmosphere/list.css'
```

## Anatomy

Parts are authored in your own markup and identified by the selector below. Required parts
must be present for the component to work. Private `data-ui-internal-*` hooks are written by
the runtime and must never be authored.

| Part | Required | Selector | Purpose |
| --- | --- | --- | --- |
| `item` | No | `[data-ui-part~='item']` | One row. Use `<li>`. |
| `title` | No | `[data-ui-part~='title']` | Primary row text. |
| `description` | No | `[data-ui-part~='description']` | Secondary row text. |

## Attributes

Every value below is implemented by the stylesheets this component ships. Boolean attributes
are presence-based: author the attribute with no value, or omit it.

| Attribute | Values | Default | Description |
| --- | --- | --- | --- |
| `data-ui-variant` | `plain` · `divided` · `inset` | `plain` | Row treatment. Numbering is the element's job, not the attribute's: use `<ol class="ui-list">` for a numbered list and `<ul class="ui-list">` for an unnumbered one. |
| `data-ui-density` | `compact` · `normal` | `normal` | Row padding. |

## Styling

Root identity: `ui-list`.
Required stylesheets: `tokens.css`, `core/list.css`, `themes/atmosphere/tokens.css`, `themes/atmosphere/list.css`.

Set these custom properties to restyle the component:

| Custom property | Controls |
| --- | --- |
| `--ui-list-gap` | Gap between rows. `divided` collapses it to zero. |
| `--ui-list-item-padding-block` | Block padding of a `divided` row. |
| `--ui-list-item-padding-inline` | Inline padding of a `divided` row. |

Design tokens this component reads (9), global and set at the theme level: `--ui-bg-surface`, `--ui-fg`, `--ui-fg-muted`, `--ui-line`, `--ui-radius-lg`, `--ui-radius-md`, `--ui-space-1`, `--ui-space-2`, `--ui-space-3`.

## Accessibility

Keep the native elements, roles, and relationships shown in the markup. Timeless adds only the
state and keyboard coordination the platform does not already provide, and it never supplies
your accessible names — those depend on your content.

This component declares no keyboard contract, because it has none of its own: the markup above
is native elements and native ARIA, and everything a keyboard or a screen reader does with it
comes from the platform. Nothing here manages focus, and nothing here adds a role you did not
author. So the accessibility of this component is the accessibility of the markup — which is why
the markup is the part worth copying exactly.

## Before JavaScript runs

This primitive is CSS only. There is nothing to register and nothing to wait for.
