Axon 911 Frontend Docs
    Loading navigation…
U
User
Switch to light mode
  1. Components
  2. Data List
  3. API and Development

Data list

API and Development

View SourceOpens in a new tabSubmit IssueOpens in a new tab
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.
Props
NameTypeDefaultDescription
aria-descriptionLocalizedMessage—Extended description for assistive tech.
aria-labelLocalizedMessage | DisplayValue—Accessible name when the visible label is insufficient.
aria-placeholderLocalizedMessage—Hint for an empty control.
childrenReactNode—Pairs: {@link DataListItem } children.
classNamestring—@deprecated Pass layout through enum props and shipped parts. Request a missing case via find-pattern.
copyRevealDataListCopyRevealDataListCopyReveal.HoverWhen copy buttons are visible. Hover reveals on hover-capable devices and on focus; touch devices always show them.
densityDataListDensityDataListDensity.DefaultGap between rows and columns.
emptyContentReactNode—Visible placeholder for an empty value, passed to EmptyText as children. Defaults to its em dash.
emptyLabelLocalizedMessage—Accessible name for an empty value that sets no emptyLabel of its own.
labelWidthDataListLabelWidthDataListLabelWidth.FitWidth of the shared label column. Ignored in the vertical and inline orientations.
loadingboolean—Replaces every value with a Skeleton text line and marks the list aria-busy. Not loading.
loadingLabelLocalizedMessage—Accessible name for each placeholder. Only meaningful while loading.
monobooleanfalseRenders values in a monospace role. A value can override it.
orientationDataListOrientationDataListOrientation.HorizontalShared label column (Horizontal), label above value (Vertical), or a flowing row of pairs (Inline).
refRef<HTMLDListElement>—Ref to the dl.
separatorbooleanfalsePaints a vertical rule between items when orientation is Inline. Ignored for Horizontal and Vertical. The list owns the space around the rule.
titleLocalizedMessage | DisplayValue—Native tooltip; accessibility hint, not visible UI title text.
Storybook
Interactive examples and edge cases for this component are in Storybook.
DefaultOpens in a new tab
Default (horizontal)
Labels share one column, sized to the widest label.
Vertical
Labels sit above their values, which suits narrow panels. labelWidth is ignored.
Inline
Each label sits beside its value and the pairs flow in a row, wrapping when the row is full. separator paints a rule between pairs.
Density and label width
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.
Links
A link is a value like any other: compose Link inside DataListValue.
Copyable values
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.
Monospace values
mono on the list renders every value in a monospace role. Set mono={false} on one value to opt it out.
Long values
A value wraps by default so every character stays visible. 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.
Empty values
An empty value (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 and errors
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.
Status values
A status dot is decorative, so pair it with visible text.
Icon and text values
A decorative icon beside text is composed from Icon and Text.
Badge values
Date and time values
Compose Time with an ISO dateTime. Pass format to let it format the instant, or pass your own text as children.
Mixed vertical example
Previous
Data list / Usage
Next
Data list / Accessibility
On this page
Props
Storybook
Default (horizontal)
Vertical
Inline
Density and label width
Links
Copyable values
Monospace values
Long values
Empty values
Loading and errors
Status values
Icon and text values
Badge values
Date and time values
Mixed vertical example