List row
A two-line row you pick one of, as in a mail inbox: chips and an age, then the message, with selected and unread states.
npx shadcn@latest add @silicon-ui/list-rowInstallation
With the shadcn CLI
npx shadcn@latest add @silicon-ui/list-rowManually
Copy these files into your project
- components/silicon-ui/list-row/list-row.tsx
- components/silicon-ui/list-row/list-row.module.css
Add the foundation, once per app, for the design and motion tokens
npx shadcn@latest add @silicon-ui/silicon-foundation
Usage
API reference
ListRow
| Prop | Type | Default |
|---|---|---|
metaThe first line: chips, a sender, counts. Any nodes, in a row 8px apart. Wrap the one item that should take the room left, and end in "…" when it runs out, in ListRowText. | ReactNode | — |
endThe end of the first line, such as the age ("2h"): muted caption type, never wrapping. | ReactNode | — |
selectedThe row that is open. It gets the muted fill and aria-current. | boolean | false |
unreadNot opened yet: the message, the ListRowText and the end are semibold in full-strength text, and screen readers hear "Unread." first. Read rows have their message in secondary text. | boolean | false |
onSelectCalled when the row is pressed. | () => void | — |
childrenThe second line, the message: two lines at most, then "…". | ReactNode | — |
Also accepts the props of ButtonHTMLAttributes<HTMLButtonElement>, except children, onSelect.
SelectableList
| Prop | Type | Default |
|---|---|---|
label*The list's name for screen readers, such as "Reports". | string | — |
children*The rows: ListRow elements. | ReactNode | — |
Also accepts the props of HTMLAttributes<HTMLUListElement>, except children.
ListRowText
| Prop | Type | Default |
|---|---|---|
children*The words, or a Chip with `shrink` (a sender with its icon). | ReactNode | — |
Also accepts the props of HTMLAttributes<HTMLSpanElement>.
Dependencies
- npm
- None
- Registry
- None