androidx.compose.foundation
BasicTooltipBoxExperimental
Composable function · from org.jetbrains.compose.foundation:foundation:1.12.2
BasicTooltipBox shows a popup next to its content, when the user hovers it, long-presses it, or when you show it from code. It has no look of its own: you draw the tooltip yourself.
Use the Material TooltipBox with PlainTooltip or RichTooltip in Material apps. They use this inside and add the shape, colors and position.
It is experimental: add @OptIn(ExperimentalFoundationApi::class).
Read more
- Tooltip (Android Developers): the Material tooltips
- Tooltips on desktop (JetBrains, Kotlin Multiplatform docs)
- BasicTooltipBox reference (Android Developers)
ParametersExperimental
@Composable
fun BasicTooltipBox(
positionProvider: PopupPositionProvider,
tooltip: @Composable () -> Unit,
state: BasicTooltipState,
modifier: Modifier = Modifier,
focusable: Boolean = true,
enableUserInput: Boolean = true,
propagateMinConstraints: Boolean = false,
content: @Composable () -> Unit,
)
positionProvider: PopupPositionProviderRequired
positionProvider: PopupPositionProviderRequiredWhere the tooltip goes, relative to the content.
tooltip: @Composable () -> UnitRequired
tooltip: @Composable () -> UnitRequiredWhat the tooltip shows. Give it a background; it has none.
state: BasicTooltipStateRequired
state: BasicTooltipStateRequiredWhether the tooltip is visible. Create it with rememberBasicTooltipState(); call show() and dismiss() from a coroutine.
modifier: ModifierOptional
modifier: ModifierOptionalDefault: Modifier
Changes size, padding, or position. See the Modifier guide.
focusable: BooleanOptional
focusable: BooleanOptionalDefault: true
Whether the tooltip takes focus when it opens. Set to true if it has buttons.
enableUserInput: BooleanOptional
enableUserInput: BooleanOptionalDefault: true
Set to false to stop hover and long-press from opening it. Then only your code opens it.
propagateMinConstraints: BooleanOptionalSince 1.11
propagateMinConstraints: BooleanOptionalSince 1.11Default: false
Set to true to pass the minimum size of the box on to the content.
content: @Composable () -> UnitRequired
content: @Composable () -> UnitRequiredThe element the tooltip belongs to, like an icon button.