Data List

A component for displaying key-value pairs in a structured list format.

Anatomy

<script>
  import {
    DataList,
    DataListItem,
    DataListItemLabel,
    DataListItemValue,
  } from "@saas-ui/svelte/components/data-list";
</script>

<DataList.Root>
  <DataList.Item>
    <DataList.ItemLabel>Status</DataList.ItemLabel>
    <DataList.ItemValue>Active</DataList.ItemValue>
  </DataList.Item>
  <DataList.Item>
    <DataList.ItemLabel>Created</DataList.ItemLabel>
    <DataList.ItemValue>Jan 1, 2024</DataList.ItemValue>
  </DataList.Item>
</DataList.Root>

Examples

Basic Accessibility

Basic DataList displaying stats with label-value pairs.

Orientation Accessibility

Use the orientation prop to control how labels and values are arranged within each item. The default horizontal orientation displays the label and value side-by-side.

Sizes Accessibility

Use the size prop on DataList.Root to change the size. Available sizes: sm, md, lg.

Vertical Accessibility

Set orientation to vertical to stack the label above the value within each item.

With Divider Accessibility

Use the divider prop to add separators between items.

Props

Prop Type Default Description
size sm | md | lg md The size of the component.
orientation vertical | horizontal horizontal -
divider boolean false -
colour accent | gray | zinc | neutral | stone | slate | red | orange | amber | yellow | lime | green | emerald | teal | cyan | sky | blue | indigo | violet | purple | fuchsia | pink | rose gray The colour theme of the component.
class text - Additional CSS classes to apply.
children any - The content to be rendered inside the component.