On this page
DataList
Label and value pairs for read-only detail, as a dl of dt and dd, so assistive technology reads each value with its label.
Use for
- read-only details such as the fields of a device or payment method
- a list of label and value pairs
- session or account metadata
Practices
| Guidance | Practice |
|---|---|
| Do | Wrap each pair in DataList.Item. |
| Do | Pass divided={false} when the pairs are few enough to scan as a block. |
| Don’t | Put long text in DataList.Value. It truncates to one line. |
API reference
DataList.Root
The dl. Carries data-divided.
Slot: cl-data-list
| Prop | Type | Description |
|---|---|---|
divided | boolean | Draws rules between the items.Default: true |
DataList.Item
One pair, as a div.
Slot: cl-data-list-item
DataList.Label
The dt.
Slot: cl-data-list-label
DataList.Value
The dd. Truncates to one line.
Slot: cl-data-list-value
Examples
Device details
<DataList.Root>
<DataList.Item>
<DataList.Label>{m.ipAddress}</DataList.Label>
<DataList.Value>{session.ipAddress}</DataList.Value>
</DataList.Item>
</DataList.Root>