# OneHandedGestureClickIndicator

## Functions summary

|---|---|
| `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/wear/compose/material3/onehandedgesture/OneHandedGestureClickIndicator.composable#OneHandedGestureClickIndicator(androidx.wear.compose.material3.onehandedgesture.OneHandedGestureConfiguration,androidx.wear.compose.material3.onehandedgesture.OneHandedGestureClickIndicatorState,androidx.compose.ui.Modifier,androidx.wear.compose.material3.onehandedgesture.OneHandedGestureIndicatorSize,androidx.compose.ui.graphics.Color,kotlin.Function0)( gestureConfiguration: https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/onehandedgesture/OneHandedGestureConfiguration, state: https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/onehandedgesture/OneHandedGestureClickIndicatorState, modifier: https://developer.android.com/reference/kotlin/androidx/compose/ui/Modifier, gestureIndicatorSize: https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/onehandedgesture/OneHandedGestureIndicatorSize, gestureIndicatorTint: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color, content: @https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable () -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html )` A wrapper that replaces the `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/onehandedgesture/package-summary#OneHandedGestureClickIndicator(androidx.wear.compose.material3.onehandedgesture.OneHandedGestureConfiguration,androidx.wear.compose.material3.onehandedgesture.OneHandedGestureClickIndicatorState,androidx.compose.ui.Modifier,androidx.wear.compose.material3.onehandedgesture.OneHandedGestureIndicatorSize,androidx.compose.ui.graphics.Color,kotlin.Function0)` to indicate to the user that a gesture action is available. |

## Functions

### OneHandedGestureClickIndicator

Artifact: [androidx.wear.compose:compose-material3](https://developer.android.com/jetpack/androidx/releases/wear-compose) [View Source](https://cs.android.com/search?q=file:androidx/wear/compose/material3/onehandedgesture/OneHandedGestureClickIndicator.kt+function:OneHandedGestureClickIndicator) Added in [1.7.0](https://developer.android.com/jetpack/androidx/releases/wear-compose#1.7.0)

```
@Composable
fun OneHandedGestureClickIndicator(
    gestureConfiguration: OneHandedGestureConfiguration,
    state: OneHandedGestureClickIndicatorState,
    modifier: Modifier = Modifier,
    gestureIndicatorSize: OneHandedGestureIndicatorSize = OneHandedGestureDefaults.indicatorSize,
    gestureIndicatorTint: Color = OneHandedGestureDefaults.indicatorTint,
    content: @Composable () -> Unit
): Unit
```

A wrapper that replaces the `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/onehandedgesture/package-summary#OneHandedGestureClickIndicator(androidx.wear.compose.material3.onehandedgesture.OneHandedGestureConfiguration,androidx.wear.compose.material3.onehandedgesture.OneHandedGestureClickIndicatorState,androidx.compose.ui.Modifier,androidx.wear.compose.material3.onehandedgesture.OneHandedGestureIndicatorSize,androidx.compose.ui.graphics.Color,kotlin.Function0)` to indicate to the user that a gesture action is available.

This component manages the visual transition between the `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/onehandedgesture/package-summary#OneHandedGestureClickIndicator(androidx.wear.compose.material3.onehandedgesture.OneHandedGestureConfiguration,androidx.wear.compose.material3.onehandedgesture.OneHandedGestureClickIndicatorState,androidx.compose.ui.Modifier,androidx.wear.compose.material3.onehandedgesture.OneHandedGestureIndicatorSize,androidx.compose.ui.graphics.Color,kotlin.Function0)` and a gesture indicator. It observes the `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/onehandedgesture/OneHandedGestureClickIndicatorState` to manage its visual transition. When `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/onehandedgesture/OneHandedGestureClickIndicatorState#showIndicator()` is called, the component replaces its `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/onehandedgesture/package-summary#OneHandedGestureClickIndicator(androidx.wear.compose.material3.onehandedgesture.OneHandedGestureConfiguration,androidx.wear.compose.material3.onehandedgesture.OneHandedGestureClickIndicatorState,androidx.compose.ui.Modifier,androidx.wear.compose.material3.onehandedgesture.OneHandedGestureIndicatorSize,androidx.compose.ui.graphics.Color,kotlin.Function0)` with a gesture animation.

Sample demonstrating a gesture indicator applied to a `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/Button.composable#Button(kotlin.Function0,androidx.compose.ui.Modifier,kotlin.Function0,kotlin.String,kotlin.Boolean,androidx.compose.ui.graphics.Shape,androidx.wear.compose.material3.ButtonColors,androidx.compose.foundation.BorderStroke,androidx.compose.foundation.layout.PaddingValues,androidx.compose.foundation.interaction.MutableInteractionSource,androidx.wear.compose.material3.SurfaceTransformation,kotlin.Function1)`:

```kotlin
import androidx.compose.foundation.interaction.MutableInteractionSource
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.wear.compose.material3.Button
import androidx.wear.compose.material3.Text
import androidx.wear.compose.material3.onehandedgesture.OneHandedGestureAction
import androidx.wear.compose.material3.onehandedgesture.OneHandedGestureClickIndicator
import androidx.wear.compose.material3.onehandedgesture.OneHandedGestureClickIndicatorState
import androidx.wear.compose.material3.onehandedgesture.oneHandedGesture
import androidx.wear.compose.material3.onehandedgesture.rememberOneHandedGestureConfiguration

var label by remember { mutableStateOf("Gesturable Button") }
val onClick = { label = "Clicked/Gestured" }
val interactionSource = remember { MutableInteractionSource() }
val gestureConfig =
    rememberOneHandedGestureConfiguration(action = OneHandedGestureAction.Primary)
val indicatorState = remember { OneHandedGestureClickIndicatorState() }
val coroutineScope = rememberCoroutineScope()

Box(modifier = Modifier.fillMaxSize(), contentAlignment = Alignment.Center) {
    Button(
        onClick = onClick,
        interactionSource = interactionSource,
        modifier =
            Modifier.fillMaxWidth()
                .oneHandedGesture(
                    gestureConfiguration = gestureConfig,
                    interactionSource = interactionSource,
                    onGestureLabel = "activate the button",
                    onGestureAvailable = {
                        coroutineScope.launch { indicatorState.showIndicator() }
                    },
                    onGesture = onClick,
                ),
    ) {
        OneHandedGestureClickIndicator(gestureConfig, indicatorState) {
            Text(label, modifier = Modifier.fillMaxWidth())
        }
    }
}
```

| Parameters |
|---|---|
| `gestureConfiguration: https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/onehandedgesture/OneHandedGestureConfiguration` | the specification for the one-handed gesture |
| `state: https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/onehandedgesture/OneHandedGestureClickIndicatorState` | The state object used to synchronize the indicator visibility. |
| `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 `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/onehandedgesture/OneHandedGestureClickIndicator.composable#OneHandedGestureClickIndicator(androidx.wear.compose.material3.onehandedgesture.OneHandedGestureConfiguration,androidx.wear.compose.material3.onehandedgesture.OneHandedGestureClickIndicatorState,androidx.compose.ui.Modifier,androidx.wear.compose.material3.onehandedgesture.OneHandedGestureIndicatorSize,androidx.compose.ui.graphics.Color,kotlin.Function0)` layout. |
| `gestureIndicatorSize: https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/onehandedgesture/OneHandedGestureIndicatorSize = OneHandedGestureDefaults.indicatorSize` | The size constraints for the gesture indicator icon. |
| `gestureIndicatorTint: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color = OneHandedGestureDefaults.indicatorTint` | The color which will be used for a tint of the gesture animation |
| `content: @https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable () -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | The original component content (e.g., Text or Icon) to be displayed when no indicator is active. See also the [UI Design Guides for One-Handed Gestures](https://developer.android.com/design/ui/wear/guides/patterns/gestures) |