{% setvar book_path %}/reference/androidx/_book.yaml{% endsetvar %} {% include "_shared/_reference-head-tags.html" %}

CaretScope

@ExperimentalMaterial3Api
public interface CaretScope


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 methods

abstract @NonNull Modifier

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

Extension functions

default final void
@Composable
@ExperimentalMaterial3Api
TooltipKt.PlainTooltip(
    @NonNull CaretScope receiver,
    @NonNull Modifier modifier,
    CaretProperties caretProperties,
    @NonNull Shape shape,
    @NonNull Color contentColor,
    @NonNull Color containerColor,
    @NonNull Dp tonalElevation,
    @NonNull Dp shadowElevation,
    @Composable @NonNull Function0<Unit> content
)

Plain tooltip that provides a descriptive message.

Public methods

drawCaret

abstract @NonNull Modifier drawCaret(
    @NonNull Modifier receiver,
    @ExtensionFunctionType @NonNull Function2<@NonNull CacheDrawScopeLayoutCoordinates, @NonNull DrawResult> draw
)

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

TooltipKt.PlainTooltip

@Composable
@ExperimentalMaterial3Api
default final void TooltipKt.PlainTooltip(
    @NonNull CaretScope receiver,
    @NonNull Modifier modifier,
    CaretProperties caretProperties,
    @NonNull Shape shape,
    @NonNull Color contentColor,
    @NonNull Color containerColor,
    @NonNull Dp tonalElevation,
    @NonNull Dp shadowElevation,
    @Composable @NonNull Function0<Unit> content
)

Plain tooltip that provides a descriptive message.

Usually used with TooltipBox.

Parameters
@NonNull Modifier modifier

the Modifier to be applied to the tooltip.

CaretProperties caretProperties

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.

@NonNull Shape shape

the Shape that should be applied to the tooltip container.

@NonNull Color contentColor

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

@NonNull Color containerColor

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

@NonNull Dp tonalElevation

the tonal elevation of the tooltip.

@NonNull Dp shadowElevation

the shadow elevation of the tooltip.

@Composable @NonNull Function0<Unit> content

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