Skip to main content

List and ListRow

import { List, ListRow } from "@study/ui"

A row has something at the front (leading), a title, a quiet second line (meta) and something at the end (trailing). With href or onClick, the whole row becomes a link or a button.

Result
Loading...
Live Editor
<Card style={{ maxWidth: 520 }}>
  <List>
    <ListRow href="#" leading={<FileTile kind="pdf" />} title="Script chapter 4 – frequency response" meta="Scripts · 3.2 MB · today" />
    <ListRow href="#" leading={<FileTile kind="word" />} title="Laplace formula sheet" meta="Other · 88 KB · Mon · Sina" />
    <ListRow leading={<FileTile kind="audio" />} title="Lecture 27 Oct" meta="84 min · transcribed" trailing={<IconButton icon="more" label="Actions for Lecture 27 Oct" size="sm" />} />
  </List>
</Card>

Variants and states​

Light

  • Dividedon white cards3.2 MB
  • Second rowwith a divider
  1. 09:45Control EngineeringLectureHS 21
  2. 13:00Materials ScienceExercise104

Dark

  • Dividedon white cards3.2 MB
  • Second rowwith a divider
  1. 09:45Control EngineeringLectureHS 21
  2. 13:00Materials ScienceExercise104

When to use​

✓ DoEither the whole row leads somewhere – or it is not a link and carries buttons.
✗ Don'tA button in a row that is itself a link: whoever hits it may end up somewhere else.
  • divided on white cards, raised (white pills) on course colours.
  • ordered for sequences, e.g. dates by time.
  • With the router: linkAs={Link} – href is then passed as to.

Props​

PropTypeDefaultMeaning
orderedboolean–An ordered list, e.g. today's events in time order.
variant"divided" | "raised"divideddivided – rows on a white card with lines between; raised – each row a white pill, for tinted cards.
PropTypeDefaultMeaning
title *ReactNode–
actionsReactNode–Controls beside a row that is itself a link or button, e.g. an `IconButton` ⋯ with a `Menu`. They sit next to the row, not inside it, so that nothing interactive is nested.
classNamestring–
hrefstring–Makes the whole row a link.
leadingReactNode–At the start: a `FileTile`, `CountdownTile`, `Avatar`, a time …
linkAsElementType–The link element, e.g. react-router's `Link` (then `href` is given as `to`).
metaReactNode–The quieter second line.
onClickMouseEventHandler<HTMLButtonElement>–Makes the whole row a button.
onContextMenuMouseEventHandler<HTMLElement>–A right click on the row, e.g. to open the same menu as its ⋯.
onMouseEnterMouseEventHandler<HTMLElement>–For a row button: hover moves the highlight here.
rowClassNamestring–A class for the row itself, e.g. to animate it away.
selectedboolean–Highlights the row, e.g. the chosen result in a search moved through with the arrow keys.
trailingReactNode–At the end: a `Chip`, a size, an `IconButton` … Interactive elements here only when the row itself is not a link or button.

Accessibility​

  • Real <ul>/<ol> with <li>: screen readers say how many entries there are.
  • A row is either clickable itself or contains clickable things – never both.