Build faster with Premium Chakra UI Components 💎

Learn more
Skip to Content
DocsPlaygroundGuidesBlog
Sponsor

DataList

Used to display a list of similar data items.

SourceStorybookRecipe
New Users
234
Sales
£12,340
Revenue
3,450

Usage

import { DataList } from "@chakra-ui/react"
<DataList.Root>
  {data.map((item) => (
    <DataList.Item key={item.label}>
      <DataList.ItemLabel>{item.label}</DataList.ItemLabel>
      <DataList.ItemValue>{item.value}</DataList.ItemValue>
    </DataList.Item>
  ))}
</DataList.Root>

Examples

Sizes

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

Name
John Doe
Name
John Doe
Name
John Doe

Variants

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

Added in v3.1.x

New Users
234
Sales
£12,340
Revenue
3,450
New Users
234
Sales
£12,340
Revenue
3,450

Orientation

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

New Users
234
Sales
£12,340
Revenue
3,450

Info Tip

Render the InfoTip component within DataList.Item to provide additional context to the datalist.

New Users
234
Sales
£12,340
Revenue
3,450

Separator

Use the divideY prop on the DataList.Root to add a separator between items.

First Name
Jassie
Last Name
Bhatia
Email
jassie@jassie.dev
Phone
1234567890
Address
1234 Main St, Anytown, USA

Closed Component

Here's how to setup the Data List for a closed component composition.

import { DataList as ChakraDataList } from "@chakra-ui/react"
import { InfoTip } from "@/components/ui/toggle-tip"
import * as React from "react"

export const DataListRoot = ChakraDataList.Root

interface ItemProps extends ChakraDataList.ItemProps {
  label: React.ReactNode
  value: React.ReactNode
  info?: React.ReactNode
  grow?: boolean
}

export const DataListItem = React.forwardRef<HTMLDivElement, ItemProps>(
  function DataListItem(props, ref) {
    const { label, info, value, children, grow, ...rest } = props
    return (
      <ChakraDataList.Item ref={ref} {...rest}>
        <ChakraDataList.ItemLabel flex={grow ? "1" : undefined}>
          {label}
          {info && <InfoTip>{info}</InfoTip>}
        </ChakraDataList.ItemLabel>
        <ChakraDataList.ItemValue flex={grow ? "1" : undefined}>
          {value}
        </ChakraDataList.ItemValue>
        {children}
      </ChakraDataList.Item>
    )
  },
)

Props

Root

PropDefaultType
colorPalette 'gray'
'gray' | 'red' | 'orange' | 'yellow' | 'green' | 'teal' | 'blue' | 'cyan' | 'purple' | 'pink' | 'accent'

The color palette of the component

orientation 'vertical'
'horizontal' | 'vertical'

The orientation of the component

size 'md'
'sm' | 'md' | 'lg'

The size of the component

Previous

Color Swatch

Next

Dialog