ListItem
A Jetpack Compose ListItem component for displaying structured list entries.
A list item component that follows Material Design 3 guidelines for structured list entries with headline, supporting text, and leading/trailing slots. See the official Jetpack Compose documentation for more information.
Installation
- npx expo install @expo/uiIf you are installing this in an existing React Native app, make sure to install expo in your project.
Usage
Basic list item
import { Host, ListItem } from '@expo/ui/jetpack-compose'; export default function BasicListItem() { return ( <Host matchContents> <ListItem headline="Settings" /> </Host> ); }
With supporting text and overline
Use the supportingText prop to add a secondary line and overlineText for a category label above the headline.
import { Host, ListItem } from '@expo/ui/jetpack-compose'; export default function ListItemWithText() { return ( <Host matchContents> <ListItem overlineText="ACCOUNT" headline="Profile" supportingText="Manage your account settings and preferences" /> </Host> ); }
With leading and trailing slots
Use ListItem.Leading and ListItem.Trailing sub-components to add content to the start and end of the list item.
import { Host, ListItem, Icon } from '@expo/ui/jetpack-compose'; export default function ListItemWithSlots() { return ( <Host matchContents> <ListItem headline="Notifications" supportingText="Manage notification preferences"> <ListItem.Leading> <Icon source={require('./assets/notifications.xml')} contentDescription="Notifications" /> </ListItem.Leading> <ListItem.Trailing> <Icon source={require('./assets/chevron_forward.xml')} contentDescription="Navigate" /> </ListItem.Trailing> </ListItem> </Host> ); }
API
import { ListItem } from '@expo/ui/jetpack-compose';
Components
Type: React.Element<SupportingContentProps>
Custom supporting content slot for ListItem.
When provided, this takes precedence over the supportingText prop.
Types
Colors for list item's core elements.
| Property | Type | Description |
|---|---|---|
| containerColor(optional) | ColorValue | - |
| headlineColor(optional) | ColorValue | - |
| leadingIconColor(optional) | ColorValue | - |
| overlineColor(optional) | ColorValue | - |
| supportingColor(optional) | ColorValue | - |
| trailingIconColor(optional) | ColorValue | - |