# LocationButton

## 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/core/locationbutton/compose/LocationButton.composable#LocationButton(androidx.compose.ui.Modifier,androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.Color,androidx.compose.ui.unit.Dp,androidx.compose.ui.unit.Dp,androidx.compose.ui.unit.Dp,androidx.compose.ui.graphics.Color,androidx.core.locationbutton.compose.LocationButtonTextType,androidx.compose.ui.graphics.Color,androidx.compose.foundation.layout.PaddingValues,kotlin.Int,kotlin.Function0,kotlin.Function1,kotlin.Function1)( modifier: https://developer.android.com/reference/kotlin/androidx/compose/ui/Modifier, backgroundColor: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color, strokeColor: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color, strokeWidth: https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp, cornerRadius: https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp, pressedCornerRadius: https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp, iconTint: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color, textType: https://developer.android.com/reference/kotlin/androidx/core/locationbutton/compose/LocationButtonTextType, textColor: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color, clickablePadding: https://developer.android.com/reference/kotlin/androidx/compose/foundation/layout/PaddingValues, compositionOrder: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, onRequestPermissions: (() -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)?, onError: ((https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-throwable/index.html) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)?, onPermissionResult: (https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html )` Displays a location button either rendered by the system or rendered locally (as a fallback). |

## Functions

### LocationButton

Artifact: [androidx.core.locationbutton:locationbutton-compose](https://developer.android.com/jetpack/androidx/releases/core-locationbutton) [View Source](https://cs.android.com/search?q=file:androidx/core/locationbutton/compose/LocationButton.kt+function:LocationButton)

```
@Composable
fun LocationButton(
    modifier: Modifier = Modifier,
    backgroundColor: Color = LocationButtonDefaults.backgroundColor,
    strokeColor: Color = LocationButtonDefaults.strokeColor,
    strokeWidth: Dp = LocationButtonDefaults.strokeWidth,
    cornerRadius: Dp = LocationButtonDefaults.cornerRadius,
    pressedCornerRadius: Dp = LocationButtonDefaults.pressedCornerRadius,
    iconTint: Color = LocationButtonDefaults.iconTint,
    textType: LocationButtonTextType = LocationButtonDefaults.textType,
    textColor: Color = LocationButtonDefaults.textColor,
    clickablePadding: PaddingValues = LocationButtonDefaults.clickablePadding,
    compositionOrder: Int = LocationButtonDefaults.defaultCompositionOrder,
    onRequestPermissions: (() -> Unit)? = null,
    onError: ((Throwable) -> Unit)? = null,
    onPermissionResult: (Boolean) -> Unit
): Unit
```

Displays a location button either rendered by the system or rendered locally (as a fallback).

Uses remote rendering on `https://developer.android.com/reference/android/os/Build.VERSION_CODES.html#CINNAMON_BUN` and later. Falls back to a local Compose implementation on platforms before `https://developer.android.com/reference/android/os/Build.VERSION_CODES.html#CINNAMON_BUN` or if remote rendering fails.

| Parameters |
|---|---|
| `modifier: https://developer.android.com/reference/kotlin/androidx/compose/ui/Modifier = Modifier` | Optional `https://developer.android.com/reference/kotlin/androidx/compose/ui/Modifier` for the button layout. |
| `backgroundColor: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color = LocationButtonDefaults.backgroundColor` | Optional background color. |
| `strokeColor: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color = LocationButtonDefaults.strokeColor` | Optional stroke color. |
| `strokeWidth: https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp = LocationButtonDefaults.strokeWidth` | Optional stroke width. |
| `cornerRadius: https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp = LocationButtonDefaults.cornerRadius` | Optional corner radius. |
| `pressedCornerRadius: https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp = LocationButtonDefaults.pressedCornerRadius` | Optional corner radius when pressed. |
| `iconTint: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color = LocationButtonDefaults.iconTint` | Optional icon tint. |
| `textType: https://developer.android.com/reference/kotlin/androidx/core/locationbutton/compose/LocationButtonTextType = LocationButtonDefaults.textType` | The predefined `https://developer.android.com/reference/kotlin/androidx/core/locationbutton/compose/LocationButtonTextType` to display. |
| `textColor: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color = LocationButtonDefaults.textColor` | Optional text color. |
| `clickablePadding: https://developer.android.com/reference/kotlin/androidx/compose/foundation/layout/PaddingValues = LocationButtonDefaults.clickablePadding` | Optional padding between the clickable boundary and the visual button. |
| `compositionOrder: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html = LocationButtonDefaults.defaultCompositionOrder` | Optional Z-order for the remote surface. |
| `onRequestPermissions: (() -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)? = null` | Optional callback when clicked on platforms before `https://developer.android.com/reference/android/os/Build.VERSION_CODES.html#CINNAMON_BUN`. If not provided, the button will automatically request location permissions using standard platform dialogs. |
| `onError: ((https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-throwable/index.html) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)? = null` | Optional callback invoked if the remote rendering session fails. Clients can use this to trigger a retry or display a custom fallback UI. |
| `onPermissionResult: (https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | Called with the permission result. Invoked on older platforms after the permission request completes (either default or custom), and on `https://developer.android.com/reference/android/os/Build.VERSION_CODES.html#CINNAMON_BUN` and later after the system-managed secure flow completes. |