Skip to Content

List

Display ordered or unordered list with optional icons and nested items.

Import

import { List, ThemeIcon } from '@tidbcloud/uikit'

Basic Usage

import { List } from '@tidbcloud/uikit' function Demo() { return ( <List> <List.Item>Clone or download repository from GitHub</List.Item> <List.Item>Install dependencies with yarn</List.Item> <List.Item>To start development server run npm start command</List.Item> <List.Item>Run tests to make sure your changes do not break the build</List.Item> <List.Item>Submit a pull request once you are done</List.Item> </List> ) }

With Icons

Replace list bullets with custom icons using the icon prop on List or List.Item.

import { List, ThemeIcon } from '@tidbcloud/uikit' import { IconCircleCheck, IconCircleDashed } from '@tabler/icons-react' function Demo() { return ( <List spacing="xs" size="sm" center icon={ <ThemeIcon color="teal" size={24} radius="xl"> <IconCircleCheck size={16} /> </ThemeIcon> } > <List.Item>Clone or download repository from GitHub</List.Item> <List.Item>Install dependencies with yarn</List.Item> <List.Item icon={ <ThemeIcon color="blue" size={24} radius="xl"> <IconCircleDashed size={16} /> </ThemeIcon> } > Submit a pull request once you are done </List.Item> </List> ) }

Nested Lists

Use withPadding prop to offset nested lists and listStyleType to control bullet type.

import { List } from '@tidbcloud/uikit' function Demo() { return ( <List listStyleType="disc"> <List.Item>First order item</List.Item> <List.Item> First order item with list <List withPadding listStyleType="disc"> <List.Item>Nested item</List.Item> <List.Item>Nested item</List.Item> </List> </List.Item> <List.Item>First order item</List.Item> </List> ) }

Key Props

PropTypeDescription
type'ordered' | 'unordered'List type (default: unordered)
iconReactNodeIcon to replace list item bullet
spacingMantineSpacingSpacing between list items
sizeMantineSizeControls font-size and line-height
centerbooleanCenter item content with icon
withPaddingbooleanOffset nested lists with padding
listStyleTypestringControls CSS list-style-type
Last updated on