API and Development
DataList is a semantic dl of label and value pairs, built from four parts. DataList owns layout, DataListItem is the div HTML allows around each pair, DataListLabel renders the dt, and DataListValue renders the dd. There are no value kinds: a value is whatever you compose inside DataListValue, such as a Badge, a Link, a Time or text.
Layout lives on the list: orientation (DataListOrientation), separator, density (DataListDensity), labelWidth (DataListLabelWidth) and mono. Each value adds overflow (DataListOverflow), copyValue with copyLabels and onCopy, loading, and error. emptyLabel names an empty value for assistive technology, and emptyContent replaces the placeholder dash. Import the parts and enums from @prepared911/ui/data-list.
| Name | Type | Default | Description |
|---|---|---|---|
aria-description | LocalizedMessage | — | Extended description for assistive tech. |
aria-label | LocalizedMessage | DisplayValue | — | Accessible name when the visible label is insufficient. |
aria-placeholder | LocalizedMessage | — | Hint for an empty control. |
children | ReactNode | — | Pairs: {@link DataListItem } children. |
className | string | — | @deprecated Pass layout through enum props and shipped parts. Request a missing case via find-pattern. |
copyReveal | DataListCopyReveal | DataListCopyReveal.Hover | When copy buttons are visible. Hover reveals on hover-capable devices and on focus; touch devices always show them. |
density | DataListDensity | DataListDensity.Default | Gap between rows and columns. |
emptyContent | ReactNode | — | Visible placeholder for an empty value, passed to EmptyText as children. Defaults to its em dash. |
emptyLabel | LocalizedMessage | — | Accessible name for an empty value that sets no emptyLabel of its own. |
labelWidth | DataListLabelWidth | DataListLabelWidth.Fit | Width of the shared label column. Ignored in the vertical and inline orientations. |
loading | boolean | — | Replaces every value with a Skeleton text line and marks the list aria-busy.
Not loading. |
loadingLabel | LocalizedMessage | — | Accessible name for each placeholder. Only meaningful while loading. |
mono | boolean | false | Renders values in a monospace role. A value can override it. |
orientation | DataListOrientation | DataListOrientation.Horizontal | Shared label column (Horizontal), label above value (Vertical), or a flowing row of pairs (Inline). |
ref | Ref<HTMLDListElement> | — | Ref to the dl. |
separator | boolean | false | Paints a vertical rule between items when orientation is Inline.
Ignored for Horizontal and Vertical. The list owns the space around the rule. |
title | LocalizedMessage | DisplayValue | — | Native tooltip; accessibility hint, not visible UI title text. |
labelWidth is ignored.
separator paints a rule between pairs.
density changes the gaps between rows and columns, never the type size. labelWidth sets the shared label column to a quarter, a third or half of the list.
Link inside DataListValue.
copyValue adds a copy button after the value. It can differ from what the value shows, such as a masked secret. copyLabels names the idle, copied and failed states and is required with it. onCopy receives the outcome. copyReveal={DataListCopyReveal.Always} keeps the buttons visible; by default they appear on hover and on focus.
mono on the list renders every value in a monospace role. Set mono={false} on one value to opt it out.
overflow={DataListOverflow.Truncate} keeps one line with an ellipsis and carries the full text as the native title. Prefer wrapping, and truncate only where the full value is available elsewhere.
null, undefined, false, an empty or blank string) renders the placeholder dash and needs an accessible name. Set emptyLabel on the list or on one value, and emptyContent to replace the dash with short copy.
loading with loadingLabel on the list replaces every value with a skeleton line; the labels stay, so nothing moves when the values arrive. Set loading on one value to load only that value. When part of a record fails, set error on the values that did not load.
Icon and Text.
Time with an ISO dateTime. Pass format to let it format the instant, or pass your own text as children.