State of Compose 2023 results are in! Click here to learn more

← Back to Material 3 Compose

Label

Component
in
Material 3
. Since 1.2.0-alpha09

Overview

Code Examples

Label component that will append a label to content. The positioning logic uses TooltipDefaults.rememberPlainTooltipPositionProvider.

Label appended to thumbs of Slider:

Overloads

Label

@ExperimentalMaterial3Api
@Composable
fun Label(
    label: @Composable () -> Unit,
    modifier: Modifier = Modifier,
    interactionSource: MutableInteractionSource = remember { MutableInteractionSource() },
    isPersistent: Boolean = false,
    content: @Composable () -> Unit
)

Parameters

NameDescription
labelcomposable that will be appended to content
modifierModifier that will be applied to content
interactionSourcethe MutableInteractionSource representing the stream of Interactions for the content.
isPersistentboolean to determine if the label should be persistent. If true, then the label will always show and be anchored to content. if false, then the label will only show when pressing down or hovering over the content.
contentthe composable that label will anchor to