Skip to main content

ListRow

BasicLayout<co-list-row>

ListRow is the 56px tappable row used for lists on phone and portal screens.

import { ListRow } from 'health-components';

Examples​

Showcase​

Storybook
Storybook

Static​

Storybook

Usage​

<ListRow leading={<Avatar name="Henna West" size="sm" />} title="Henna West" meta="9:20 AM . Follow-Up" onClick={open} />

When to use​

  • Lists of patients, messages, settings on phones.

When not to use​

  • Desktop tables: DataTable.

Variants and states​

VariantWhat it is
static / buttononClick makes it a button with a chevron.
leading / trailingAvatar, badge.

Accessibility​

  • Whole row is one button.

Do and don't​

  • Do: Two lines max.
  • Don't: Nested buttons inside a button row.

Props​

PropTypeDefaultDescription
title *string—Main line
metastringnoneSecond line
leadingReactNodenoneBefore the text (Avatar, Icon)
trailingReactNodenoneAfter the text (StatusTag, time); must not be interactive when the row is
onClick(event: MouseEvent<HTMLElement>) => voidnoneMakes the row a button with a chevron
hrefstringnoneMakes the row a link with a chevron
targetAnchorHTMLAttributes<HTMLAnchorElement>['target']—Link target when `href` is set

Also accepts native attributes, including defaultChecked, defaultValue, autoFocus, plus className and event handlers on the root element.

Angular, Vue and HTML​

Register the elements once (Angular guide), then use <co-list-row>. Attributes take strings; arrays and objects are set as properties (Angular [prop], Vue :prop) or as JSON attributes. Callbacks are DOM events with the value in event.detail.

Angular template
<co-list-row title="…" meta="…" [target]="target" (co-click)="onClick($event.detail)"></co-list-row>
KindNameDescription
attributetitleMain line
attributemetaSecond line; default none
attributehrefMakes the row a link with a chevron; default none
property / JSON attributetargetLink target when `href` is set
attributedefault-checked / defaultChecked
property / JSON attributedefault-value / defaultValue
attributeauto-focus / autoFocus
eventco-clickMakes the row a button with a chevron; default none (React: onClick)
slotleadingBefore the text (Avatar, Icon); default none Plain text also works as the `leading` attribute.
slottrailingAfter the text (StatusTag, time); must not be interactive when the row is; default none Plain text also works as the `trailing` attribute.