Back to Shark UI

Data List

docs/components/data-list

latest7.0 KB
Original Source

Sections

Components

Utilities

Forms

Hooks

Data List

Copy Markdown

A list of label-value pairs.

PreviewCode

New Users234

Sales£12,340

Revenue3,450

Installation#

CLIManual

pnpmbunnpmyarn

pnpm dlx shadcn@latest add @shark/data-list

Anatomy#

DataList
└── DataListItem
    ├── DataListItemLabel
    └── DataListItemValue

Usage#

import {
  DataList,
  DataListItem,
  DataListItemLabel,
  DataListItemValue,
} from "@/components/ui/data-list";
<DataList>
  <DataListItem>
    <DataListItemLabel>Name</DataListItemLabel>
    <DataListItemValue>John Doe</DataListItemValue>
  </DataListItem>
  <DataListItem>
    <DataListItemLabel>Email</DataListItemLabel>
    <DataListItemValue>[email protected]</DataListItemValue>
  </DataListItem>
</DataList>

Orientation#

Use the orientation prop to change the orientation of the datalist component.

Horizontal#

PreviewCode

First NameJassie

Last NameBhatia

[email protected]

Vertical#

PreviewCode

First NameJassie

Last NameBhatia

[email protected]

Examples#

Info Tip#

PreviewCode

New Users234

Sales£12,340

Revenue3,450

Separator#

Use the divide-y utility class on DataList to add a separator between items.

PreviewCode

First NameJassie

Last NameBhatia

[email protected]

Phone1234567890

Address1234 Main St, Anytown, USA

API Reference#

DataList#

Root wrapper for label-value list layout.

PropTypeDefault
orientation`"horizontal""vertical"`
classNamestring-
asChildbooleanfalse

DataListItem#

Single label-value row.

PropTypeDefault
classNamestring-
asChildbooleanfalse

DataListItemLabel#

Label or key for the row.

PropTypeDefault
classNamestring-
asChildbooleanfalse

DataListItemValue#

Value or content for the row.

PropTypeDefault
classNamestring-
asChildbooleanfalse

[

Previous page

Context Menu ](/docs/components/context-menu)[

Next page

Date Input ](/docs/components/date-input)

On This Page

InstallationAnatomyUsageOrientationHorizontalVerticalExamplesInfo TipSeparatorAPI ReferenceDataListDataListItemDataListItemLabelDataListItemValue