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

# RemoteTextToggleButton

## Functions summary

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

## Functions

### RemoteTextToggleButton

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/RemoteTextToggleButton.kt+function:RemoteTextToggleButton) 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 RemoteTextToggleButton(
    checked: RemoteBoolean,
    onCheckedChange: RemoteAction,
    modifier: RemoteModifier = RemoteModifier,
    enabled: RemoteBoolean = true.rb,
    colors: RemoteTextToggleButtonColors = RemoteTextToggleButtonDefaults.colors(),
    shapes: RemoteTextToggleButtonShapes = RemoteTextToggleButtonDefaults.shapes(),
    border: RemoteBorderStroke? = null,
    content: @Composable @RemoteComposable () -> Unit
): Unit
```

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

Set the size of the `RemoteTextToggleButton` with `RemoteModifier.size` to one of the recommended sizes in `RemoteTextToggleButtonDefaults` (for example `RemoteTextToggleButtonDefaults.Size`). The recommended text styles for each corresponding size are `RemoteTextToggleButtonDefaults.textStyle`, `RemoteTextToggleButtonDefaults.largeTextStyle` and `RemoteTextToggleButtonDefaults.extraLargeTextStyle`.

`RemoteTextToggleButton` 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 `RemoteTextToggleButton`:

```kotlin
import androidx.compose.remote.creation.compose.action.valueChangeAction
import androidx.compose.remote.creation.compose.state.MutableRemoteBoolean
import androidx.compose.remote.creation.compose.state.rs
import androidx.compose.runtime.remember
import androidx.wear.compose.remote.material3.RemoteText
import androidx.wear.compose.remote.material3.RemoteTextToggleButton

val checked = remember { MutableRemoteBoolean(true) }

RemoteTextToggleButton(
    checked = checked,
    onCheckedChange = valueChangeAction(checked, !checked),
    modifier = modifier,
) {
    RemoteText("ABC".rs)
}
```

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

```kotlin
import androidx.compose.remote.creation.compose.action.valueChangeAction
import androidx.compose.remote.creation.compose.state.MutableRemoteBoolean
import androidx.compose.remote.creation.compose.state.rs
import androidx.compose.runtime.remember
import androidx.wear.compose.remote.material3.RemoteText
import androidx.wear.compose.remote.material3.RemoteTextToggleButton
import androidx.wear.compose.remote.material3.RemoteTextToggleButtonDefaults

val checked = remember { MutableRemoteBoolean(true) }

RemoteTextToggleButton(
    checked = checked,
    onCheckedChange = valueChangeAction(checked, !checked),
    modifier = modifier,
    shapes = RemoteTextToggleButtonDefaults.variantShapes(),
) {
    RemoteText("ABC".rs)
}
```

Example of a `RemoteTextToggleButton` 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.state.MutableRemoteBoolean
import androidx.compose.remote.creation.compose.state.rs
import androidx.compose.runtime.remember
import androidx.wear.compose.remote.material3.RemoteText
import androidx.wear.compose.remote.material3.RemoteTextToggleButton
import androidx.wear.compose.remote.material3.RemoteTextToggleButtonDefaults

val checked = remember { MutableRemoteBoolean(true) }

RemoteTextToggleButton(
    checked = checked,
    onCheckedChange = valueChangeAction(checked, !checked),
    modifier = modifier,
    shapes = RemoteTextToggleButtonDefaults.variantAnimatedShapes(),
) {
    RemoteText("ABC".rs)
}
```

| 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: RemoteTextToggleButtonColors = RemoteTextToggleButtonDefaults.colors()` | `RemoteTextToggleButtonColors` that will be used to resolve the container and content color for this toggle button. |
| `shapes: RemoteTextToggleButtonShapes = RemoteTextToggleButtonDefaults.shapes()` | Defines the shapes for this toggle button in the checked and unchecked states, and while pressed. Defaults to a static shape based on `RemoteTextToggleButtonDefaults.shape`. A variant that changes shape when checked is available through `RemoteTextToggleButtonDefaults.variantShapes`, and shapes that animate when pressed are available through `RemoteTextToggleButtonDefaults.animatedShapes` and `RemoteTextToggleButtonDefaults.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 text to be drawn inside the toggle button. |