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

← Back to Material 3 Compose

RichTooltipBox

Component
in
Material 3
. Since 1.1.0

Overview

Code Examples

Rich text tooltip that allows the user to pass in a title, text, and action. Tooltips are used to provide a descriptive message for an anchor.

Tooltip that is invoked when the anchor is long pressed:

Overloads

RichTooltipBox

@Composable
@ExperimentalMaterial3Api
fun RichTooltipBox(
    text: @Composable () -> Unit,
    modifier: Modifier = Modifier,
    title: (@Composable () -> Unit)? = null,
    action: (@Composable () -> Unit)? = null,
    tooltipState: RichTooltipState = rememberRichTooltipState(action != null),
    shape: Shape = TooltipDefaults.richTooltipContainerShape,
    colors: RichTooltipColors = TooltipDefaults.richTooltipColors(),
    content: @Composable TooltipBoxScope.() -> Unit
)

Parameters

NameDescription
textthe message to be displayed in the center of the tooltip.
modifierthe Modifier to be applied to the tooltip.
tooltipStatehandles the state of the tooltip's visibility.
titleAn optional title for the tooltip.
actionAn optional action for the tooltip.
shapethe Shape that should be applied to the tooltip container.
colorsRichTooltipColors that will be applied to the tooltip's container and content.
contentthe composable that the tooltip will anchor to