Composable Function

RemoteTextToggleButton

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.

RemoteTextToggleButton

Source set: Android
@Composable
public fun RemoteTextToggleButton(
    checked: RemoteBoolean,
    onCheckedChange: Action,
    modifier: RemoteModifier = RemoteModifier,
    enabled: RemoteBoolean = true.rb,
    colors: RemoteTextToggleButtonColors = RemoteTextToggleButtonDefaults.colors(),
    shapes: RemoteTextToggleButtonShapes = RemoteTextToggleButtonDefaults.shapes(),
    border: RemoteDp? = null,
    borderColor: RemoteColor? = null,
    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.

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 valueChange(checked, !checked).

Example of a simple RemoteTextToggleButton:

Example of a RemoteTextToggleButton that changes shape when checked:

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

Parameters

checked Boolean flag indicating whether this toggle button is currently checked.
onCheckedChange Action to be performed when this toggle button is clicked.
modifier Modifier to be applied to the toggle button.
enabled Controls the enabled state of the toggle button. When false, this toggle button will not be clickable. Note that only constant values are currently supported for enabled for click handling.
colors RemoteTextToggleButtonColors that will be used to resolve the container and content color for this toggle button.
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 Optional RemoteDp border stroke width for this toggle button.
borderColor Optional RemoteColor for the border of this toggle button.
content The text to be drawn inside the toggle button.

Content updated: