New Compose Multiplatform components arrived on Composables UICheck it out →

Component in Compose Foundation

BoxWithTooltip

Desktop

Sets the tooltip for an element.

Last updated:

Installation

dependencies {
   implementation("androidx.compose.foundation:foundation:1.7.0-beta04")
}

Overloads

@Suppress("UNUSED_PARAMETER"
@Deprecated(
    "Use TooltipArea",
    replaceWith = ReplaceWith(
        "TooltipArea(tooltip, modifier, delay, tooltipPlacement, content)"
    )

@Composable
@OptIn(ExperimentalFoundationApi::class
fun BoxWithTooltip(
    tooltip: @Composable () -> Unit,
    modifier: Modifier = Modifier,
    contentAlignment: Alignment = Alignment.TopStart,
    propagateMinConstraints: Boolean = false,
    delay: Int = 500,
    tooltipPlacement: TooltipPlacement = TooltipPlacement.CursorPoint(
        offset = DpOffset(0.dp, 16.dp)
    ),
    content: @Composable () -> Unit
)

Parameters

namedescription
tooltipComposable content of the tooltip.
modifierThe modifier to be applied to the layout.
contentAlignmentThe default alignment inside the Box.
propagateMinConstraintsWhether the incoming min constraints should be passed to content.
delayDelay in milliseconds.
tooltipPlacementDefines position of the tooltip.
contentComposable content that the current tooltip is set to.