Build apps faster with our new App builder! Check it out →

ListHeader

Android

Component in Wear Material 3 Compose

A slot based composable for creating a list header item. [ListHeader]s are typically expected to be a few words of text on a single line. The contents will be start and end padded.

Last updated:

Installation

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

Overloads

@Composable
fun ListHeader(
    modifier: Modifier = Modifier,
    backgroundColor: Color = Color.Transparent,
    contentColor: Color = ListHeaderDefaults.ContentColor,
    contentPadding: PaddingValues = ListHeaderDefaults.ContentPadding,
    content: @Composable RowScope.() -> Unit
)

Parameters

namedescription
modifierThe modifier for the [ListHeader].
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.
contentSlot for [ListHeader] content, expected to be a single line of text.

Code Example

ListHeaderSample

@Composable
fun ListHeaderSample() {
    ListHeader { Text("Header") }
}
by @alexstyl