TooltipScope
-
Cmn
@ExperimentalMaterial3Api
sealed interface 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 |
Cmn
|
PopupPositionProvider |
Used to obtain the |
Cmn
|
Extension functions |
||
|---|---|---|
Unit |
@ComposablePlain tooltip that provides a descriptive message. |
Cmn
|
Unit |
@ComposableRich 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.
obtainPositionProvider
fun obtainPositionProvider(): PopupPositionProvider
Used to obtain the PopupPositionProvider used. This can be used to help draw the caret pointing to the anchor content.
Extension functions
PlainTooltip
@Composable
@ExperimentalMaterial3Api
fun TooltipScope.PlainTooltip(
modifier: Modifier = Modifier,
caretShape: Shape? = null,
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 |
caretShape: Shape? = null |
|
maxWidth: Dp = TooltipDefaults.plainTooltipMaxWidth |
the maximum width for the plain tooltip |
shape: Shape = TooltipDefaults.plainTooltipContainerShape |
the |
contentColor: Color = TooltipDefaults.plainTooltipContentColor |
|
containerColor: Color = TooltipDefaults.plainTooltipContainerColor |
|
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 TooltipScope.RichTooltip(
modifier: Modifier = Modifier,
title: (@Composable () -> Unit)? = null,
action: (@Composable () -> Unit)? = null,
caretShape: Shape? = null,
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 |
title: (@Composable () -> Unit)? = null |
An optional title for the tooltip. |
action: (@Composable () -> Unit)? = null |
An optional action for the tooltip. |
caretShape: Shape? = null |
|
maxWidth: Dp = TooltipDefaults.richTooltipMaxWidth |
the maximum width for the plain tooltip |
shape: Shape = TooltipDefaults.richTooltipContainerShape |
the |
colors: RichTooltipColors = TooltipDefaults.richTooltipColors() |
|
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. |