New Compose Multiplatform components arrived on Composables UICheck it out →

ListSubheader

A two slot based composable for creating a list subheader item. [ListSubheader]s offer slots for an icon and for a text label. The contents will be start and end padded.

Last updated:

Installation

dependencies {
   implementation("androidx.wear.compose:compose-material3:1.0.0-alpha23")
}

Overloads

@Composable
fun ListSubheader(
    modifier: Modifier = Modifier,
    backgroundColor: Color = Color.Transparent,
    contentColor: Color = ListSubHeaderTokens.ContentColor.value,
    contentPadding: PaddingValues = ListHeaderDefaults.SubheaderContentPadding,
    icon: (@Composable BoxScope.() -> Unit)? = null,
    label: @Composable RowScope.() -> Unit,
)

Parameters

namedescription
modifierThe modifier for the [ListSubheader].
backgroundColorThe background color to apply - typically Color.Transparent
contentColorThe color to apply to content.
contentPaddingThe spacing values to apply internally between the container and the content.
iconA slot for providing icon to the [ListSubheader].
labelA slot for providing label to the [ListSubheader].

Code Examples

ListSubheaderSample

@Composable
@Sampled
fun ListSubheaderSample() {
    ListSubheader {
        Text("Subheader")
    }
}

ListSubheaderWithIconSample

@Composable
@Sampled
fun ListSubheaderWithIconSample() {
    ListSubheader(
        label = { Text(text = "Subheader") },
        icon = { Icon(imageVector = Icons.Outlined.Home, "home") }
    )
}