Rows of people, files or things: a picture, a title, details and actions.
$ pnpm dlx shadcn@latest add @dashral/listInstallation
$ pnpm dlx shadcn@latest add @dashral/listAdds the component, the components it builds on, its npm packages and the theme tokens it uses. Or by its full URL: https://dashral.com/r/list.json
Usage
import { Avatar } from "@/components/dashral/avatar"
import { List } from "@/components/dashral/list"
<List
variant="card"
items={members.map((member) => ({
media: <Avatar name={member.name} />,
title: member.name,
description: member.email,
meta: member.role,
href: `/team/${member.id}`,
}))}
/>Using the npm package? Import from @dashral/ui/components/list instead, here and in the examples; the rest is the same.
Examples
Settings links
Whole rows that link, with a chevron; one current, one disabled.
- ProfileYour name, photo and email
- SecurityPassword and two-factor sign-in
- NotificationsWhat we tell you, and how
- BillingPlan, invoices and payment methodPro
- API keysAvailable on the Team plan
API reference
List
Also takes every prop of <ul>(opens in a new tab).
| Prop | Type | Default |
|---|---|---|
items | { title, description?, media?, meta?, actions?, href?, onClick?, active?, disabled?, key? }[]The rows. Required. | — |
variant | "default" | "card"Rows on the page, or inside a bordered card. | "default" |
divided | booleanLines between the rows. | true |
size | "sm" | "default"sm for popovers, sidebars and dense panels. | "default" |
empty | ReactNodeShown in place of the rows when there are none. | — |
linkAs | ElementTypeYour router's link, for rows with href. | "a" |
classNames | { item, media, title, description, meta, actions }Classes for each part. | — |
className | stringExtra classes, merged with cn() so yours win. | — |
Keyboard
| Keys | Action |
|---|---|
| Tab | To each row's link or button, then its own actions |
Accessibility
- A <ul role="list"> (Safari keeps it a list without bullets). A row with href or onClick has one link or button, its title, stretched over the row; its actions stay separate controls.
- The current row has aria-current; a disabled row has no link.
- It restacks by its own width (a container query), not the screen's, so it works in narrow cards and sidebars.