Caret 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

Modifier

Modifier that is used to draw the caret for the tooltip.

Cmn

Extension functions

Unit
@Composable
@ExperimentalMaterial3Api
CaretScope.PlainTooltip(
    modifier: Modifier,
    caretProperties: CaretProperties?,
    shape: Shape,
    contentColor: Color,
    containerColor: Color,
    tonalElevation: Dp,
    shadowElevation: Dp,
    content: @Composable () -> Unit
)

Plain tooltip that provides a descriptive message.

Cmn
android
Unit
@Composable
@ExperimentalMaterial3Api
CaretScope.RichTooltip(
    modifier: Modifier,
    title: (@Composable () -> Unit)?,
    action: (@Composable () -> Unit)?,
    caretProperties: CaretProperties?,
    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
android

Public functions

drawCaret

fun Modifier.drawCaret(draw: CacheDrawScope.(LayoutCoordinates?) -> DrawResult): Modifier

Modifier that is used to draw the caret for the tooltip. A LayoutCoordinates will be provided that can be used to obtain the bounds of the anchor content, which can be used to draw the caret more precisely. PlainTooltip and RichTooltip have default implementations for their caret.

Extension functions

PlainTooltip

@Composable
@ExperimentalMaterial3Api
fun CaretScope.PlainTooltip(
    modifier: Modifier = Modifier,
    caretProperties: CaretProperties? = null,
    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.

caretProperties: CaretProperties? = null

CaretProperties for the caret of the tooltip, if a default caret is desired with a specific dimension. Please see TooltipDefaults.caretProperties to see the default dimensions. Pass in null for this parameter if no caret is desired.

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.

RichTooltip

@Composable
@ExperimentalMaterial3Api
fun CaretScope.RichTooltip(
    modifier: Modifier = Modifier,
    title: (@Composable () -> Unit)? = null,
    action: (@Composable () -> Unit)? = null,
    caretProperties: CaretProperties? = null,
    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.

caretProperties: CaretProperties? = null

CaretProperties for the caret of the tooltip, if a default caret is desired with a specific dimension. Pass in null for this parameter if no caret is desired.

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.