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 fontSize="sm" color="foreground-muted">
Sign up with your email address
</Text>
</Box>
</ListItem>
<ListItem>
<Box>
<Box fontWeight="medium">Verify your email</Box>
<Text fontSize="sm" color="foreground-muted">
Click the link in your inbox
</Text>
</Box>
</ListItem>
<ListItem>
<Box>
<Box fontWeight="medium">Complete your profile</Box>
<Text fontSize="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)

ListItem

PropTypeDefaultDescription
childrenReactNode-Item content

ListIcon

PropTypeDefaultDescription
childrenReactNode-Icon content

TypeScript

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