# TooltipScope

Artifact: [androidx.compose.material3:material3](https://developer.android.com/jetpack/androidx/releases/compose-material3) [View Source](https://cs.android.com/search?q=file:androidx/compose/material3/Tooltip.kt+class:androidx.compose.material3.TooltipScope) Common/AllAndroid/JVM
- Cmn

  ```
  @ExperimentalMaterial3Api
  sealed interface TooltipScope
  ```

*** ** * ** ***

Tooltip scope for `https://developer.android.com/reference/kotlin/androidx/compose/material3/TooltipBox.composable#TooltipBox(androidx.compose.ui.window.PopupPositionProvider,kotlin.Function1,androidx.compose.material3.TooltipState,androidx.compose.ui.Modifier,kotlin.Function0,kotlin.Boolean,kotlin.Boolean,kotlin.Boolean,kotlin.Function0)` to be used to obtain the `https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/LayoutCoordinates` of the anchor content, and to draw a caret for the tooltip.

## Summary

| ### Public functions |
|---|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/LayoutCoordinates?` | `@https://developer.android.com/reference/kotlin/androidx/compose/runtime/annotation/FrequentlyChangingValue https://developer.android.com/reference/kotlin/androidx/compose/material3/TooltipScope#obtainAnchorBounds()()` Used to obtain the `https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/LayoutCoordinates` of the anchor content. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/window/PopupPositionProvider` | `https://developer.android.com/reference/kotlin/androidx/compose/material3/TooltipScope#obtainPositionProvider()()` Used to obtain the `https://developer.android.com/reference/kotlin/androidx/compose/ui/window/PopupPositionProvider` used. | Cmn |

| ### Extension functions |
|---|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable @https://developer.android.com/reference/kotlin/androidx/compose/material3/ExperimentalMaterial3Api https://developer.android.com/reference/kotlin/androidx/compose/material3/TooltipScope.https://developer.android.com/reference/kotlin/androidx/compose/material3/TooltipScope#(androidx.compose.material3.TooltipScope).PlainTooltip(androidx.compose.ui.Modifier,androidx.compose.ui.graphics.Shape,androidx.compose.ui.unit.Dp,androidx.compose.ui.graphics.Shape,androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.Color,androidx.compose.ui.unit.Dp,androidx.compose.ui.unit.Dp,kotlin.Function0)( modifier: https://developer.android.com/reference/kotlin/androidx/compose/ui/Modifier, caretShape: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Shape?, maxWidth: https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp, shape: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Shape, contentColor: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color, containerColor: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color, tonalElevation: https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp, shadowElevation: https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp, content: @https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable () -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html )` Plain tooltip that provides a descriptive message. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable @https://developer.android.com/reference/kotlin/androidx/compose/material3/ExperimentalMaterial3Api https://developer.android.com/reference/kotlin/androidx/compose/material3/TooltipScope.https://developer.android.com/reference/kotlin/androidx/compose/material3/TooltipScope#(androidx.compose.material3.TooltipScope).RichTooltip(androidx.compose.ui.Modifier,kotlin.Function0,kotlin.Function0,androidx.compose.ui.graphics.Shape,androidx.compose.ui.unit.Dp,androidx.compose.ui.graphics.Shape,androidx.compose.material3.RichTooltipColors,androidx.compose.ui.unit.Dp,androidx.compose.ui.unit.Dp,kotlin.Function0)( modifier: https://developer.android.com/reference/kotlin/androidx/compose/ui/Modifier, title: (@https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable () -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)?, action: (@https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable () -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)?, caretShape: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Shape?, maxWidth: https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp, shape: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Shape, colors: https://developer.android.com/reference/kotlin/androidx/compose/material3/RichTooltipColors, tonalElevation: https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp, shadowElevation: https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp, text: @https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable () -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html )` Rich text tooltip that allows the user to pass in a title, text, and action. | Cmn |

## Public functions

### obtainAnchorBounds

Cmn

```
@FrequentlyChangingValue
fun obtainAnchorBounds(): LayoutCoordinates?
```

Used to obtain the `https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/LayoutCoordinates` of the anchor content. This can be used to help draw the caret pointing to the anchor content.

### obtainPositionProvider

Cmn

```
fun obtainPositionProvider(): PopupPositionProvider
```

Used to obtain the `https://developer.android.com/reference/kotlin/androidx/compose/ui/window/PopupPositionProvider` used. This can be used to help draw the caret pointing to the anchor content.

## Extension functions

### TooltipScope.PlainTooltip

Cmn Artifact: [androidx.compose.material3:material3](https://developer.android.com/jetpack/androidx/releases/compose-material3) [View Source](https://cs.android.com/search?q=file:androidx/compose/material3/Tooltip.kt+function: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 `https://developer.android.com/reference/kotlin/androidx/compose/material3/TooltipBox.composable#TooltipBox(androidx.compose.ui.window.PopupPositionProvider,kotlin.Function1,androidx.compose.material3.TooltipState,androidx.compose.ui.Modifier,kotlin.Function0,kotlin.Boolean,kotlin.Boolean,kotlin.Boolean,kotlin.Function0)`.

| Parameters |
|---|---|
| `modifier: https://developer.android.com/reference/kotlin/androidx/compose/ui/Modifier = Modifier` | the `https://developer.android.com/reference/kotlin/androidx/compose/ui/Modifier` to be applied to the tooltip. |
| `caretShape: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Shape? = null` | `https://developer.android.com/reference/kotlin/androidx/compose/material3/package-summary#(androidx.compose.material3.TooltipScope).PlainTooltip(androidx.compose.ui.Modifier,androidx.compose.ui.graphics.Shape,androidx.compose.ui.unit.Dp,androidx.compose.ui.graphics.Shape,androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.Color,androidx.compose.ui.unit.Dp,androidx.compose.ui.unit.Dp,kotlin.Function0)` for the caret of the tooltip. If a default caret is desired with a specific dimension please use `https://developer.android.com/reference/kotlin/androidx/compose/material3/TooltipDefaults#caretShape()`. To see the default dimensions please see `https://developer.android.com/reference/kotlin/androidx/compose/material3/TooltipDefaults#caretSize()`. If no caret is desired, please pass in null. |
| `maxWidth: https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp = TooltipDefaults.plainTooltipMaxWidth` | the maximum width for the plain tooltip |
| `shape: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Shape = TooltipDefaults.plainTooltipContainerShape` | the `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Shape` that should be applied to the tooltip container. |
| `contentColor: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color = TooltipDefaults.plainTooltipContentColor` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color` that will be applied to the tooltip's content. |
| `containerColor: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color = TooltipDefaults.plainTooltipContainerColor` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color` that will be applied to the tooltip's container. |
| `tonalElevation: https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp = 0.dp` | the tonal elevation of the tooltip. |
| `shadowElevation: https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp = 0.dp` | the shadow elevation of the tooltip. |
| `content: @https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable () -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | the composable that will be used to populate the tooltip's content. |

### TooltipScope.RichTooltip

Cmn Artifact: [androidx.compose.material3:material3](https://developer.android.com/jetpack/androidx/releases/compose-material3) [View Source](https://cs.android.com/search?q=file:androidx/compose/material3/Tooltip.kt+function: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 `https://developer.android.com/reference/kotlin/androidx/compose/material3/TooltipBox.composable#TooltipBox(androidx.compose.ui.window.PopupPositionProvider,kotlin.Function1,androidx.compose.material3.TooltipState,androidx.compose.ui.Modifier,kotlin.Function0,kotlin.Boolean,kotlin.Boolean,kotlin.Boolean,kotlin.Function0)`

| Parameters |
|---|---|
| `modifier: https://developer.android.com/reference/kotlin/androidx/compose/ui/Modifier = Modifier` | the `https://developer.android.com/reference/kotlin/androidx/compose/ui/Modifier` to be applied to the tooltip. |
| `title: (@https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable () -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)? = null` | An optional title for the tooltip. |
| `action: (@https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable () -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)? = null` | An optional action for the tooltip. |
| `caretShape: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Shape? = null` | `https://developer.android.com/reference/kotlin/androidx/compose/material3/package-summary#(androidx.compose.material3.TooltipScope).RichTooltip(androidx.compose.ui.Modifier,kotlin.Function0,kotlin.Function0,androidx.compose.ui.graphics.Shape,androidx.compose.ui.unit.Dp,androidx.compose.ui.graphics.Shape,androidx.compose.material3.RichTooltipColors,androidx.compose.ui.unit.Dp,androidx.compose.ui.unit.Dp,kotlin.Function0)` for the caret of the tooltip. If a default caret is desired with a specific dimension please use `https://developer.android.com/reference/kotlin/androidx/compose/material3/TooltipDefaults#caretShape()`. To see the default dimensions please see `https://developer.android.com/reference/kotlin/androidx/compose/material3/TooltipDefaults#caretSize()`. If no caret is desired, please pass in null. |
| `maxWidth: https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp = TooltipDefaults.richTooltipMaxWidth` | the maximum width for the plain tooltip |
| `shape: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Shape = TooltipDefaults.richTooltipContainerShape` | the `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Shape` that should be applied to the tooltip container. |
| `colors: https://developer.android.com/reference/kotlin/androidx/compose/material3/RichTooltipColors = TooltipDefaults.richTooltipColors()` | `https://developer.android.com/reference/kotlin/androidx/compose/material3/RichTooltipColors` that will be applied to the tooltip's container and content. |
| `tonalElevation: https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp = ElevationTokens.Level0` | the tonal elevation of the tooltip. |
| `shadowElevation: https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp = RichTooltipTokens.ContainerElevation` | the shadow elevation of the tooltip. |
| `text: @https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable () -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | the composable that will be used to populate the rich tooltip's text. |