androidx.compose.material3
LabelExperimental
Composable function
One of the helpers on this page. It works like ProvideTextStyle. Only the parameters that differ are described here.
Shows a short label above its content on hover or long press. Lighter than a tooltip.

Box(Modifier.size(160.dp, 100.dp), contentAlignment = Alignment.BottomCenter) {
Label(
label = { PlainTooltip { Text("Favorite") } },
// Always shown. Without it, the label shows on hover or long press.
isPersistent = true,
) {
Icon(Icons.Filled.Favorite, contentDescription = "Favorite")
}
}
ParametersExperimental
@Composable
fun Label(
label: @Composable TooltipScope.() -> Unit,
modifier: Modifier = Modifier,
interactionSource: MutableInteractionSource? = null,
isPersistent: Boolean = false,
content: @Composable () -> Unit,
)
label: @Composable TooltipScope.() -> UnitRequired
label: @Composable TooltipScope.() -> UnitRequiredThe text of the label, shown on hover or long press.
modifier: ModifierOptional
modifier: ModifierOptionalDefault: Modifier
Changes size, padding, or position. See the Modifier guide.
interactionSource: MutableInteractionSource?Optional
interactionSource: MutableInteractionSource?OptionalDefault: null
Lets you observe or control press, hover and focus states. Leave it null unless your code must react to them. See InteractionSource.
isPersistent: BooleanOptional
isPersistent: BooleanOptionalDefault: false
Set to true to always show the label, not only on hover or long press.
Same as in ProvideTextStyle: content.