Compose Component

ListItem

ListItem is a component used to represent a single item in a androidx.xr.glimmer.list.GlimmerLazyColumn.

ListItemSample

@Sampled
@Composable
fun ListItemSample() {
    ListItem { Text("Primary Label") }
}

ListItemWithSupportingLabelSample

@Sampled
@Composable
fun ListItemWithSupportingLabelSample() {
    ListItem(supportingLabel = { Text("Supporting Label") }) { Text("Primary Label") }
}

ListItemWithSupportingLabelAndLeadingIconSample

@Sampled
@Composable
fun ListItemWithSupportingLabelAndLeadingIconSample() {
    ListItem(
        supportingLabel = { Text("Supporting Label") },
        leadingIcon = { Icon(FavoriteIcon, "Localized description") },
    ) {
        Text("Primary Label")
    }
}

ClickableListItemSample

@Sampled
@Composable
fun ClickableListItemSample() {
    ListItem(onClick = {}) { Text("Primary Label") }
}

ClickableListItemWithSupportingLabelSample

@Sampled
@Composable
fun ClickableListItemWithSupportingLabelSample() {
    ListItem(onClick = {}, supportingLabel = { Text("Supporting Label") }) { Text("Primary Label") }
}

ClickableListItemWithSupportingLabelAndLeadingIconSample

@Sampled
@Composable
fun ClickableListItemWithSupportingLabelAndLeadingIconSample() {
    ListItem(
        onClick = {},
        supportingLabel = { Text("Supporting Label") },
        leadingIcon = { Icon(FavoriteIcon, "Localized description") },
    ) {
        Text("Primary Label")
    }
}
Jetpack Compose beyond MaterialFree components, screens and templates for apps that don’t look like Google’s. Copy them into your app, or let your coding agent add them.Browse for free

Content updated: