Terms and their values: a record's details, a summary, an invoice's totals.
$ pnpm dlx shadcn@latest add @dashral/description-listInstallation
$ pnpm dlx shadcn@latest add @dashral/description-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/description-list.json
Usage
import { DescriptionList } from "@/components/dashral/description-list"
<DescriptionList
items={[
{ term: "Customer", description: customer.name },
{ term: "Email", description: customer.email },
{ term: "Tax ID", description: customer.taxId },
]}
/>Using the npm package? Import from @dashral/ui/components/description-list instead, here and in the examples; the rest is the same.
Examples
Totals
layout="justified" puts the value at the far end; divided adds lines.
API reference
DescriptionList
Also takes every prop of <dl>(opens in a new tab).
| Prop | Type | Default |
|---|---|---|
items | { term, description?, span?: "full", key? }[]The terms and values. Required. | — |
layout | "inline" | "justified" | "stacked"The term beside the value, at either end, or above it. | "inline" |
columns | 1 | 2 | 3 | 4With stacked: side by side from the sm breakpoint (one on phones). | 1 |
divided | booleanLines between the items. | false |
termWidth | stringWith inline: the term column's width. | "8rem" |
size | "sm" | "default"sm for dense panels. | "default" |
empty | ReactNodeIn place of an empty value. | a muted dash |
classNames | { item, term, description }Classes for each part. | — |
className | stringExtra classes, merged with cn() so yours win. | — |
Accessibility
- A real <dl>, with each <dt> and <dd> in a <div>, so screen readers read each value with its term.
- The dash for an empty value is hidden from screen readers.