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
- Divided3.2 MB
- Second row
- 09:45Control EngineeringHS 21
- 13:00Materials Science104
Dark
- Divided3.2 MB
- Second row
- 09:45Control EngineeringHS 21
- 13:00Materials Science104
When to use
- Script.pdf
- Recording 27 Oct
✓ 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.
dividedon white cards,raised(white pills) on course colours.orderedfor sequences, e.g. dates by time.- With the router:
linkAs={Link}–hrefis then passed asto.
Props
| Prop | Type | Default | Meaning |
|---|---|---|---|
ordered | boolean | – | An ordered list, e.g. today's events in time order. |
variant | "divided" | "raised" | divided | divided – rows on a white card with lines between; raised – each row a white pill, for tinted cards. |
| Prop | Type | Default | Meaning |
|---|---|---|---|
title * | ReactNode | – | |
actions | ReactNode | – | 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. |
className | string | – | |
href | string | – | Makes the whole row a link. |
leading | ReactNode | – | At the start: a `FileTile`, `CountdownTile`, `Avatar`, a time … |
linkAs | ElementType | – | The link element, e.g. react-router's `Link` (then `href` is given as `to`). |
meta | ReactNode | – | The quieter second line. |
onClick | MouseEventHandler<HTMLButtonElement> | – | Makes the whole row a button. |
onContextMenu | MouseEventHandler<HTMLElement> | – | A right click on the row, e.g. to open the same menu as its ⋯. |
onMouseEnter | MouseEventHandler<HTMLElement> | – | For a row button: hover moves the highlight here. |
rowClassName | string | – | A class for the row itself, e.g. to animate it away. |
selected | boolean | – | Highlights the row, e.g. the chosen result in a search moved through with the arrow keys. |
trailing | ReactNode | – | 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.