Skip to main content

List

List is a semantic list component for displaying ordered or unordered items.

Open in Storybook

Import​

import { List, ListItem, ListIcon } from "@tosui/react";

Basic usage​

Ordered list​

  1. Step one
  2. Step two
  3. Step three

Style types​

None (default for ul)
  • Item without bullet
  • Another item
Disc
  • Item with bullet
  • Another item
Decimal (default for ol)
  1. Numbered item
  2. Another item

Spacing​

No spacing (default)
  • First item
  • Second item
  • Third item
With spacing
  • First item
  • Second item
  • Third item

With icons​

Use ListIcon to add custom icons to list items.

import { CheckIcon, StarIcon } from "your-icon-library";

<List spacing={2}>
<ListItem>
<ListIcon><CheckIcon /></ListIcon>
Feature one
</ListItem>
<ListItem>
<ListIcon><CheckIcon /></ListIcon>
Feature two
</ListItem>
<ListItem>
<ListIcon><StarIcon /></ListIcon>
Premium feature
</ListItem>
</List>

Common patterns​

Feature list​

<List spacing={3}>
<ListItem>
<ListIcon><CheckIcon /></ListIcon>
Unlimited users
</ListItem>
<ListItem>
<ListIcon><CheckIcon /></ListIcon>
API access
</ListItem>
<ListItem>
<ListIcon><CheckIcon /></ListIcon>
24/7 support
</ListItem>
<ListItem>
<ListIcon><CheckIcon /></ListIcon>
Custom integrations
</ListItem>
</List>

Steps​

<List as="ol" spacing={4}>
<ListItem>
<Box>
<Box fontWeight="medium">Create an account</Box>
<Text size="sm" color="foreground-muted">
Sign up with your email address
</Text>
</Box>
</ListItem>
<ListItem>
<Box>
<Box fontWeight="medium">Verify your email</Box>
<Text size="sm" color="foreground-muted">
Click the link in your inbox
</Text>
</Box>
</ListItem>
<ListItem>
<Box>
<Box fontWeight="medium">Complete your profile</Box>
<Text size="sm" color="foreground-muted">
Add your details and preferences
</Text>
</Box>
</ListItem>
</List>

Props reference​

List​

PropTypeDefaultDescription
as"ul" | "ol""ul"HTML list element
styleType"none" | "disc" | "decimal"depends on asList style type
spacingnumber0Gap between items (spacing multiplier)
classNamestring-Additional CSS class
childrenReactNode-List items

ListItem​

PropTypeDefaultDescription
childrenReactNode-Item content
classNamestring-Additional CSS class

ListIcon​

PropTypeDefaultDescription
childrenReactNode-Icon content
classNamestring-Additional CSS class

TypeScript​

import { List, ListItem, ListIcon, type ListStyleType, type ListProps, type ListItemProps, type ListIconProps } from "@tosui/react";