NativeTemplates

ListItem

A versatile component for creating interactive list items.

ListItem

A flexible component for creating list items with leading and trailing elements, supporting text, icons, and avatars.

Import

import ListItem from '@/components/layout/ListItem';

Features

  • Support for leading elements (icon, avatar, or custom component)
  • Primary title with optional subtitle
  • Trailing elements for actions or indicators
  • Link navigation via href
  • Press handling support
  • Automatic disabled state styling
  • Dark mode compatible

Props

PropTypeDefaultDescription
titleReact.ReactNodeRequiredPrimary text or component
subtitleReact.ReactNode—Secondary text or component
leadingReact.ReactNode—Custom leading component
avatar{ src?: string, name?: string, size?: 'xs' | 'sm' | 'md' }—Avatar configuration
iconIconConfig—Icon configuration for leading element
trailingReact.ReactNode—Custom trailing component
trailingIconIconConfig—Icon configuration for trailing element
disabledbooleanfalseWhether the item is disabled
classNamestring''Additional Tailwind classes
styleViewStyle—Additional style object
hrefstring—Navigation link destination
onPress() => void—Handler for press events

Basic Usage

// Basic list item with title and subtitle
<ListItem 
  title="Account Settings"
  subtitle="Manage your profile and preferences"
/>
 
// List item with icon and navigation
<ListItem
  title="Notifications"
  icon={{ name: "Bell" }}
  trailingIcon={{ name: "ChevronRight" }}
  href="/settings/notifications"
/>
 
// List item with avatar
<ListItem
  title="John Doe"
  subtitle="Online"
  avatar={{ src: "https://example.com/avatar.jpg", size: "sm" }}
  onPress={() => handleUserSelect()}
/>
 
// Disabled list item
<ListItem
  title="Premium Feature"
  subtitle="Upgrade your account to access"
  icon={{ name: "Lock" }}
  disabled
/>

On this page