Tooltip

fun Tooltip(expanded: MutableState<Boolean>, modifier: Modifier = Modifier, timeoutMillis: Long = TooltipTimeout, backgroundColor: Color = Color.Black, offset: DpOffset = TooltipOffset, properties: PopupProperties = TooltipPopupProperties, content: @Composable ColumnScope.() -> Unit)

Tooltip implementation for AndroidX Jetpack Compose. Based on material DropdownMenu implementation

A Tooltip behaves similarly to a Popup, and will use the position of the parent layout to position itself on screen. Commonly a Tooltip will be placed in a Box with a sibling that will be used as the 'anchor'. Note that a Tooltip by itself will not take up any space in a layout, as the tooltip is displayed in a separate window, on top of other content.

The content of a Tooltip will typically be Text, as well as custom content.

Tooltip changes its positioning depending on the available space, always trying to be fully visible. It will try to expand horizontally, depending on layout direction, to the end of its parent, then to the start of its parent, and then screen end-aligned. Vertically, it will try to expand to the bottom of its parent, then from the top of its parent, and then screen top-aligned. An offset can be provided to adjust the positioning of the menu for cases when the layout bounds of its parent do not coincide with its visual bounds. Note the offset will be applied in the direction in which the menu will decide to expand.

Parameters

expanded

Whether the tooltip is currently visible to the user

offset

DpOffset to be added to the position of the tooltip

See also


fun Tooltip(expanded: MutableState<Boolean>, text: String, modifier: Modifier = Modifier, timeoutMillis: Long = TooltipTimeout, backgroundColor: Color = Color.Black, offset: DpOffset = TooltipOffset, properties: PopupProperties = TooltipPopupProperties)

Simple text version of Tooltip