> Documentation index: https://developer.android.com/reference/llms.txt

# RemoteIconToggleButton

## Functions summary

|---|---|
| `Unit` | `@Composable @RemoteComposable RemoteIconToggleButton( checked: RemoteBoolean, onCheckedChange: RemoteAction, modifier: RemoteModifier, enabled: RemoteBoolean, colors: RemoteIconToggleButtonColors, shapes: RemoteIconToggleButtonShapes, border: RemoteBorderStroke?, content: @Composable @RemoteComposable () -> Unit )` Wear Material `RemoteIconToggleButton` is a filled icon toggle button which switches between primary colors and tonal colors depending on `checked` value, and offers a single slot for icon or image. |

## Functions

### RemoteIconToggleButton

Artifact: [androidx.wear.compose.remote:remote-material3](https://developer.android.com/jetpack/androidx/releases/wear-compose-remote.md.txt) [View Source](https://cs.android.com/search?q=file:androidx/wear/compose/remote/material3/RemoteIconToggleButton.kt+function:RemoteIconToggleButton) Added in [1.0.0-alpha16](https://developer.android.com/jetpack/androidx/releases/wear-compose-remote.md.txt#1.0.0-alpha16)

```
@Composable
@RemoteComposable
fun RemoteIconToggleButton(
    checked: RemoteBoolean,
    onCheckedChange: RemoteAction,
    modifier: RemoteModifier = RemoteModifier,
    enabled: RemoteBoolean = true.rb,
    colors: RemoteIconToggleButtonColors = RemoteIconToggleButtonDefaults.colors(),
    shapes: RemoteIconToggleButtonShapes = RemoteIconToggleButtonDefaults.shapes(),
    border: RemoteBorderStroke? = null,
    content: @Composable @RemoteComposable () -> Unit
): Unit
```

Wear Material `RemoteIconToggleButton` is a filled icon toggle button which switches between primary colors and tonal colors depending on `checked` value, and offers a single slot for icon or image.

Set the size of the `RemoteIconToggleButton` with `RemoteModifier.size` to one of the recommended sizes in `RemoteIconToggleButtonDefaults` (for example `RemoteIconToggleButtonDefaults.Size`), and size the icon with `RemoteIconToggleButtonDefaults.iconSizeFor`.

`RemoteIconToggleButton` can be enabled or disabled. A disabled button will not respond to click events. When enabled, the `onCheckedChange` action is triggered on click, and is typically used to flip the `checked` state, for example with `valueChangeAction(checked, !checked)`.

Example of a simple `RemoteIconToggleButton`:

```kotlin
import androidx.compose.remote.creation.compose.action.valueChangeAction
import androidx.compose.remote.creation.compose.modifier.RemoteModifier
import androidx.compose.remote.creation.compose.modifier.size
import androidx.compose.remote.creation.compose.state.MutableRemoteBoolean
import androidx.compose.runtime.remember
import androidx.wear.compose.remote.material3.RemoteIcon
import androidx.wear.compose.remote.material3.RemoteIconToggleButton
import androidx.wear.compose.remote.material3.RemoteIconToggleButtonDefaults
import androidx.wear.compose.remote.material3.previews.utils.TestImageVectors

val checked = remember { MutableRemoteBoolean(true) }

RemoteIconToggleButton(
    checked = checked,
    onCheckedChange = valueChangeAction(checked, !checked),
    modifier = modifier,
) {
    RemoteIcon(
        imageVector = TestImageVectors.VolumeUp,
        contentDescription = null,
        modifier = RemoteModifier.size(RemoteIconToggleButtonDefaults.DefaultIconSize),
    )
}
```

Example of a `RemoteIconToggleButton` that changes shape when checked:

```kotlin
import androidx.compose.remote.creation.compose.action.valueChangeAction
import androidx.compose.remote.creation.compose.modifier.RemoteModifier
import androidx.compose.remote.creation.compose.modifier.size
import androidx.compose.remote.creation.compose.state.MutableRemoteBoolean
import androidx.compose.runtime.remember
import androidx.wear.compose.remote.material3.RemoteIcon
import androidx.wear.compose.remote.material3.RemoteIconToggleButton
import androidx.wear.compose.remote.material3.RemoteIconToggleButtonDefaults
import androidx.wear.compose.remote.material3.previews.utils.TestImageVectors

val checked = remember { MutableRemoteBoolean(true) }

RemoteIconToggleButton(
    checked = checked,
    onCheckedChange = valueChangeAction(checked, !checked),
    modifier = modifier,
    shapes = RemoteIconToggleButtonDefaults.variantShapes(),
) {
    RemoteIcon(
        imageVector = TestImageVectors.VolumeUp,
        contentDescription = null,
        modifier = RemoteModifier.size(RemoteIconToggleButtonDefaults.DefaultIconSize),
    )
}
```

Example of a `RemoteIconToggleButton` that changes shape when checked and animates its shape when pressed:

```kotlin
import androidx.compose.remote.creation.compose.action.valueChangeAction
import androidx.compose.remote.creation.compose.modifier.RemoteModifier
import androidx.compose.remote.creation.compose.modifier.size
import androidx.compose.remote.creation.compose.state.MutableRemoteBoolean
import androidx.compose.runtime.remember
import androidx.wear.compose.remote.material3.RemoteIcon
import androidx.wear.compose.remote.material3.RemoteIconToggleButton
import androidx.wear.compose.remote.material3.RemoteIconToggleButtonDefaults
import androidx.wear.compose.remote.material3.previews.utils.TestImageVectors

val checked = remember { MutableRemoteBoolean(true) }

RemoteIconToggleButton(
    checked = checked,
    onCheckedChange = valueChangeAction(checked, !checked),
    modifier = modifier,
    shapes = RemoteIconToggleButtonDefaults.variantAnimatedShapes(),
) {
    RemoteIcon(
        imageVector = TestImageVectors.VolumeUp,
        contentDescription = null,
        modifier = RemoteModifier.size(RemoteIconToggleButtonDefaults.DefaultIconSize),
    )
}
```

| Parameters |
|---|---|
| `checked: RemoteBoolean` | Boolean flag indicating whether this toggle button is currently checked. |
| `onCheckedChange: RemoteAction` | `RemoteAction` to be performed when this toggle button is clicked. |
| `modifier: RemoteModifier = RemoteModifier` | Modifier to be applied to the toggle button. |
| `enabled: RemoteBoolean = true.rb` | Controls the enabled state of the toggle button. When `false`, this toggle button will not be clickable. It must be a constant value. |
| `colors: RemoteIconToggleButtonColors = RemoteIconToggleButtonDefaults.colors()` | `RemoteIconToggleButtonColors` that will be used to resolve the container and content color for this toggle button. |
| `shapes: RemoteIconToggleButtonShapes = RemoteIconToggleButtonDefaults.shapes()` | Defines the shapes for this toggle button in the checked and unchecked states, and while pressed. Defaults to a static shape based on `RemoteIconToggleButtonDefaults.shape`. A variant that changes shape when checked is available through `RemoteIconToggleButtonDefaults.variantShapes`, and shapes that animate when pressed are available through `RemoteIconToggleButtonDefaults.animatedShapes` and `RemoteIconToggleButtonDefaults.variantAnimatedShapes`. The press animation is driven by touch events on the player, and is not shown by players that don't dispatch them. |
| `border: RemoteBorderStroke? = null` | Optional `RemoteBorderStroke` for this toggle button. |
| `content: @Composable @RemoteComposable () -> Unit` | The content to be drawn inside the toggle button, expected to be an icon or image. |