Skip to the content

List

A <ul> built from a content array: each item is text, a link (to / href) or a selectable row. Pass interactive for rows that keyboards and screen readers reach, or static for display-only rows.
Data Display

When to use

Use when
  • A short list of options with single or multiple selection, or a side menu.
  • A phone list of tappable rows with a title, description, meta and trailing control (interactive).
  • Display-only rows that span a card — a label over a Meter, a name over its meta (static).
Avoid when
  • Rows with several columns — use Table.
  • Long lists that need virtualization — use DataTable.
  • Prose bullets in running text — use Text.

Usage

  • Item 1
  • Item 2
  • Item 3
import { List } from '@apollion-dsi/core/elements/list';

<List content={[{ title: 'Item 1' }, { title: 'Item 2' }, { title: 'Item 3' }]} />;

Without interactive or static, items are single-line lis that respond to the pointer only. That is the layout Dropdown menus use.

Selection

A click toggles an item; selecting one clears the others. multiple keeps several selected, showCheckIcon marks them, and exclusive keeps exactly one on (a click on the selected row keeps it). isSelected in content stays in sync after mount. onSelectItems receives the whole list; onItemClick receives the clicked item.

  • Light
  • Dark
  • System
<List exclusive showCheckIcon content={themes} onItemClick={(item) => setTheme(item.id)} />

Interactive rows

interactive puts a <button type="button"> in each li, or a Link when the item has to / href. Rows are at least 44px tall, titles wrap, and description, meta and trailing render. trailing sits beside the row's control, never inside it, so a Switch there is not nested in a button.

  • ButtonDocs page
import { Link as RouterLink } from 'react-router-dom';

<List interactive linkAs={RouterLink} onItemClick={(item) => openRun(item.id)} content={runs} />;

Link items render a native <a href> (from href, else to) and skip the toggle. Pass the app's link component as linkAs for client routing; it receives to / href as given. An external href always renders a native <a>.

Static rows

static renders rows that are read, not tapped. The text column grows to the row and wraps, so a Meter in description spans the card. No handler, hover or 44px floor; selection props are ignored. An item with to / href renders its title as a link. interactive wins when both are set.

  • Pass rate
    82%
  • Review gate
    41%
<List static content={[{ title: 'Pass rate', description: <Meter label="Pass rate" value={82} />, trailing: '82%' }]} />

Accessibility

  • Use interactive for any row a keyboard or screen-reader user must reach: Tab reaches every row and Enter activates it (Space too on a button row).
  • Selection is announced as aria-pressed in a selection mode (multiple, exclusive, showCheckIcon), else as aria-current.
  • Give a trailing control its own accessible name (<Switch aria-label="…" />).
  • One primary action per row, plus at most one trailing control.

Properties

Beyond the props above, every component accepts the layout props (spacing, color, flex/grid, sizing, border) — not repeated here.

See also