List Item
Data Display
Navigation
Versatile list item component for directory-style lists with icons, descriptions, and actions.
Preview
Interactive list with icons and navigation
Profile
Manage your profile settings
Notifications
Configure alerts and emails
Security
Password and two-factor auth
Basic List
Simple list items with title and description
Profile Settings
Update your personal information
Notifications
Configure how you receive alerts
Security
Manage your account security
Subscription
View and manage your plan
With End Content
List items with badges or status indicators
Messages
5 new
Tasks
3 pending
Favorites
12 items
Recent
Today
With Avatars
User list with avatars and role badges
SW
Sarah Wilson
sarah@example.com
Admin
JS
John Smith
john@example.com
Member
EC
Emily Chen
emily@example.com
Member
Sizes
Small, medium, and large list item sizes
Small
Small item
Compact size
Medium (default)
Medium item
Default size
Large
Large item
Spacious size
Props
Component API reference
ListItem
| Prop | Type | Default | Description |
|---|---|---|---|
title* | ReactNode | — | Primary text content |
description | ReactNode | — | Secondary text below title |
startContent | ReactNode | — | Icon or avatar at the start |
endContent | ReactNode | — | Badge or content at the end |
showChevron | boolean | false | Show navigation chevron |
variant | 'default' | 'ghost' | 'bordered' | 'default' | Visual style variant |
size | 'sm' | 'md' | 'lg' | 'md' | Size variant |
onClick | () => void | — | Click handler |
disabled | boolean | false | Disable the item |
className | string | — | Additional CSS classes |
List
| Prop | Type | Default | Description |
|---|---|---|---|
children* | ReactNode | — | ListItem components |
divided | boolean | false | Add dividers between items |
rounded | boolean | false | Add border radius and border |
className | string | — | Additional CSS classes |
Usage
Import and implementation examples
import { ListItem, List } from '@/components/ui/list-item'
import { Avatar, AvatarFallback } from '@/components/ui/avatar'
import { Badge } from '@/components/ui/badge'
import { Settings, Mail } from 'lucide-react'
// Basic list
<List rounded divided>
<ListItem title="Item 1" description="Description" />
<ListItem title="Item 2" description="Description" />
</List>
// With icon
<ListItem
title="Settings"
description="Manage preferences"
startContent={<Settings className="w-5 h-5" />}
/>
// Interactive with chevron
<ListItem
title="Navigate"
showChevron
onClick={() => console.log('clicked')}
/>
// With end content
<ListItem
title="Messages"
endContent={<Badge>5 new</Badge>}
/>
// With avatar
<ListItem
title="John Doe"
description="john@example.com"
startContent={
<Avatar size="sm">
<AvatarFallback>JD</AvatarFallback>
</Avatar>
}
/>Features
Built-in functionality
- Flexible content slots: Start, end, title, and description slots for custom content
- Interactive states: Hover, focus, and active states with keyboard support
- 3 size variants: Small, medium, and large sizing options
- List wrapper: List component with dividers and rounded border options
- Chevron indicator: Optional navigation chevron for clickable items
- Text truncation: Automatic truncation for long content
- Dark mode: Full dark mode support with adjusted colors
Accessibility
Accessibility considerations
ARIA Attributes
Interactive items use button roleDisabled state communicated via aria-disabledList structure uses semantic list markupKeyboard Navigation
| Key | Action |
|---|---|
| Tab | Navigate between list items |
| Enter / Space | Activate clickable items |
Notes
- Focus indicators visible on all interactive items
- Color contrast meets WCAG guidelines
- Icons are decorative and hidden from screen readers