TooltipScope


Tooltip scope for TooltipBox to be used to obtain the LayoutCoordinates of the anchor content, and to draw a caret for the tooltip.

Summary

Public functions

LayoutCoordinates?

Used to obtain the LayoutCoordinates of the anchor content.

Cmn

Extension functions

Unit
@Composable
@ExperimentalMaterial3Api
TooltipScope.PlainTooltip(
    modifier: Modifier,
    caretSize: DpSize,
    maxWidth: Dp,
    shape: Shape,
    contentColor: Color,
    containerColor: Color,
    tonalElevation: Dp,
    shadowElevation: Dp,
    content: @Composable () -> Unit
)

Plain tooltip that provides a descriptive message.

Cmn
Unit
@Composable
@ExperimentalMaterial3Api
TooltipScope.RichTooltip(
    modifier: Modifier,
    title: (@Composable () -> Unit)?,
    action: (@Composable () -> Unit)?,
    caretSize: DpSize,
    maxWidth: Dp,
    shape: Shape,
    colors: RichTooltipColors,
    tonalElevation: Dp,
    shadowElevation: Dp,
    text: @Composable () -> Unit
)

Rich text tooltip that allows the user to pass in a title, text, and action.

Cmn

Public functions

obtainAnchorBounds

fun MeasureScope.obtainAnchorBounds(): LayoutCoordinates?

Used to obtain the LayoutCoordinates of the anchor content. This can be used to help draw the caret pointing to the anchor content.

Extension functions

@Composable
@ExperimentalMaterial3Api
fun TooltipScope.PlainTooltip(
    modifier: Modifier = Modifier,
    caretSize: DpSize = DpSize.Unspecified,
    maxWidth: Dp = TooltipDefaults.plainTooltipMaxWidth,
    shape: Shape = TooltipDefaults.plainTooltipContainerShape,
    contentColor: Color = TooltipDefaults.plainTooltipContentColor,
    containerColor: Color = TooltipDefaults.plainTooltipContainerColor,
    tonalElevation: Dp = 0.dp,
    shadowElevation: Dp = 0.dp,
    content: @Composable () -> Unit
): Unit

Plain tooltip that provides a descriptive message.

Usually used with TooltipBox.

Parameters
modifier: Modifier = Modifier

the Modifier to be applied to the tooltip.

caretSize: DpSize = DpSize.Unspecified

DpSize for the caret of the tooltip, if a default caret is desired with a specific dimension. Please see TooltipDefaults.caretSize to see the default dimensions. Pass in Dp.Unspecified for this parameter if no caret is desired.

maxWidth: Dp = TooltipDefaults.plainTooltipMaxWidth

the maximum width for the plain tooltip

shape: Shape = TooltipDefaults.plainTooltipContainerShape

the Shape that should be applied to the tooltip container.

contentColor: Color = TooltipDefaults.plainTooltipContentColor

Color that will be applied to the tooltip's content.

containerColor: Color = TooltipDefaults.plainTooltipContainerColor

Color that will be applied to the tooltip's container.

tonalElevation: Dp = 0.dp

the tonal elevation of the tooltip.

shadowElevation: Dp = 0.dp

the shadow elevation of the tooltip.

content: @Composable () -> Unit

the composable that will be used to populate the tooltip's content.

@Composable
@ExperimentalMaterial3Api
fun TooltipScope.RichTooltip(
    modifier: Modifier = Modifier,
    title: (@Composable () -> Unit)? = null,
    action: (@Composable () -> Unit)? = null,
    caretSize: DpSize = DpSize.Unspecified,
    maxWidth: Dp = TooltipDefaults.richTooltipMaxWidth,
    shape: Shape = TooltipDefaults.richTooltipContainerShape,
    colors: RichTooltipColors = TooltipDefaults.richTooltipColors(),
    tonalElevation: Dp = ElevationTokens.Level0,
    shadowElevation: Dp = RichTooltipTokens.ContainerElevation,
    text: @Composable () -> Unit
): Unit

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

Usually used with TooltipBox

Parameters
modifier: Modifier = Modifier

the Modifier to be applied to the tooltip.

title: (@Composable () -> Unit)? = null

An optional title for the tooltip.

action: (@Composable () -> Unit)? = null

An optional action for the tooltip.

caretSize: DpSize = DpSize.Unspecified

DpSize for the caret of the tooltip, if a default caret is desired with a specific dimension. Please see TooltipDefaults.caretSize to see the default dimensions. Pass in Dp.Unspecified for this parameter if no caret is desired.

maxWidth: Dp = TooltipDefaults.richTooltipMaxWidth

the maximum width for the rich tooltip

shape: Shape = TooltipDefaults.richTooltipContainerShape

the Shape that should be applied to the tooltip container.

colors: RichTooltipColors = TooltipDefaults.richTooltipColors()

RichTooltipColors that will be applied to the tooltip's container and content.

tonalElevation: Dp = ElevationTokens.Level0

the tonal elevation of the tooltip.

shadowElevation: Dp = RichTooltipTokens.ContainerElevation

the shadow elevation of the tooltip.

text: @Composable () -> Unit

the composable that will be used to populate the rich tooltip's text.