TooltipBox

fun TooltipBox(positionProvider: PopupPositionProvider, tooltip: @Composable TooltipScope.() -> Unit, state: TooltipState, modifier: Modifier = Modifier, focusable: Boolean = false, enableUserInput: Boolean = true, content: @Composable () -> Unit)

A tooltip box that anchors a tooltip (a PlainTooltip or RichTooltip) to its content.

The tooltip is shown on hover (desktop / web) or long press (touch), or programmatically via TooltipState.show. It is built on the foundation tooltip primitives, so triggering, the global single-tooltip behavior, and the auto-dismiss timeout match the platform behavior.

Parameters

positionProvider
tooltip

the tooltip content.

state

the TooltipState controlling visibility.

modifier

the modifier applied to the anchor wrapper.

focusable

whether the tooltip is focusable; true for interactive rich tooltips so an outside tap dismisses them and their actions are reachable.

enableUserInput

whether hover / long press on the anchor shows the tooltip.

content

the anchor content.


fun TooltipBox(text: String, modifier: Modifier = Modifier, state: TooltipState = rememberTooltipState(isPersistent = false), enabled: Boolean = true, positioning: TooltipAnchorPosition = TooltipAnchorPosition.Below, containerColor: Color = TooltipDefaults.plainTooltipContainerColor, contentColor: Color = TooltipDefaults.plainTooltipContentColor, content: @Composable () -> Unit)

A plain tooltip convenience that wraps TooltipBox + PlainTooltip for a short text label.

Parameters

text

the text label of the tooltip.

modifier

the modifier applied to the anchor wrapper.

state

the TooltipState controlling visibility.

enabled

whether hover / long press on the anchor shows the tooltip.

positioning

the preferred TooltipAnchorPosition of the tooltip.

containerColor

the container color of the tooltip.

contentColor

the content color of the tooltip.

content

the anchor content.