Description List
ProA semantic key/value detail view for records: profiles, invoices, settings read-outs. It renders a real dl/dt/dd tree, splits term and value at sm, and any value cell composes Koala parts like Badge or Avatar.
Installation#
Usage#
The preview is yours to explore. Its code comes with a Pro license, paid once and used in every project.
Have a license? Unlock it here
Anatomy#
import {
DescriptionList,
DescriptionListItem,
DescriptionTerm,
DescriptionDetails,
} from "@/components/ui/description-list"
<DescriptionList>
<DescriptionListItem>
<DescriptionTerm />
<DescriptionDetails />
</DescriptionListItem>
</DescriptionList>Layout#
row (default) places the term in a fixed-width column with the value beside it, splitting at the sm breakpoint and stacking on mobile. stack keeps the term above the value at every width, better for narrow surfaces and long values. auto and inline follow below. A term that leads with an icon keeps the value on its text's baseline, not the icon's edge.
Values with pictures#
A value can lead with an Avatar, a Flag, a logo or icon, a Badge or a Select, and the row still reads on the text: the name sits on the term's baseline and the picture is centred on that line, 8px from the text after it. Put them straight in DescriptionDetails with no flex or alignment classes: a flex value takes its baseline from its first item, so a leading picture would hand the row its bottom edge and drop the text below the term.
Auto layout#
layout="auto" splits by the list's own width instead of the viewport's. The term asks for --dl-term (12rem) and the value for --dl-value (10rem); when both fit on one line they sit side by side, and when they don't, the value wraps under its term. So a narrow card on a wide screen stacks, a phone drawer with a short term keeps its rows, and the switch point moves with the term column you set. The same list is shown below in a 20rem and a 28rem column.
Inline#
layout="inline" flows the pairs along a line, each term straight before its value, and wraps when the line runs out: a strip of facts under a heading or inside a row. The pairs carry no row padding and no rule; the gaps between them do the separating.
Divided#
Set divided for a hairline rule between rows. Turns a loose list into a scannable, table-like read.
Density#
Density tunes the per-row vertical padding. compact (the default) suits dashboards; comfortable gives a roomier marketing read. It also honors a surrounding DensityProvider.
Custom term width#
In row layout the term column width is the CSS variable --dl-term (default 12rem). Override it per instance via an inline style or class, no recipe surgery needed.
API reference#
DescriptionList
The root <dl>; forwards all native <dl> props and shares its variants with every part through context. Every part accepts className, merged last.
| Prop | Type | Default | Description |
|---|---|---|---|
| layout | "row" | "stack" | "auto" | "inline" | "row" | row splits term and value at the sm viewport, stack keeps the term above, auto splits by the list's own width, inline flows the pairs along a line. |
| divided | boolean | false | Hairline rule between rows; the last row drops it. Ignored by inline. |
| density | "comfortable" | "compact" | "compact" | Per-row vertical padding: 12px or 8px. Ignored by inline. Falls back to the nearest DensityProvider. |
| asChild | boolean | false | Merge onto your own element through Radix Slot instead of rendering a <dl>. |
| CSS variable | Description |
|---|---|
| --dl-term | Term column width in row and auto layouts (default 12rem); row caps it at half the list's width. |
| --dl-value | In auto layout, the least room a value needs beside its term before it wraps under it (default 10rem). |
DescriptionListItem
One term/value pair, a <div> grouping inside the <dl> (valid HTML5). Forwards all native <div> props.
| Prop | Type | Default | Description |
|---|---|---|---|
| asChild | boolean | false | Merge onto your own element through Radix Slot instead of rendering a <div>. |
DescriptionTerm
The muted label, a <dt>. A leading Koala icon is sized to 16px and centred while the text keeps the baseline. Forwards all native <dt> props.
DescriptionDetails
The value, a <dd> with tabular-nums. A leading Avatar, Flag, svg, img, Badge or Select trigger is centred on the text line without flex classes. Forwards all native <dd> props.