RemoteSplitSwitchButton

Functions summary

Unit
@RemoteComposable
@Composable
RemoteSplitSwitchButton(
    checked: RemoteBoolean,
    onCheckedChange: Action,
    toggleContentDescription: RemoteString?,
    onContainerClick: Action,
    modifier: RemoteModifier,
    enabled: RemoteBoolean,
    shape: RemoteShape,
    colors: RemoteSplitSwitchButtonColors,
    contentPadding: RemotePaddingValues,
    secondaryLabel: (@Composable @RemoteComposable RemoteRowScope.() -> Unit)?,
    label: @Composable @RemoteComposable RemoteRowScope.() -> Unit
)

The Wear Material SplitSwitchButton offers two slots and shows the current toggle state via a switch.

Functions

@RemoteComposable
@Composable
fun RemoteSplitSwitchButton(
    checked: RemoteBoolean,
    onCheckedChange: Action,
    toggleContentDescription: RemoteString?,
    onContainerClick: Action,
    modifier: RemoteModifier = RemoteModifier,
    enabled: RemoteBoolean = true.rb,
    shape: RemoteShape = RemoteSplitSwitchButtonDefaults.shape,
    colors: RemoteSplitSwitchButtonColors = RemoteSplitSwitchButtonDefaults.splitSwitchButtonColors(),
    contentPadding: RemotePaddingValues = RemoteSplitSwitchButtonDefaults.ContentPadding,
    secondaryLabel: (@Composable @RemoteComposable RemoteRowScope.() -> Unit)? = null,
    label: @Composable @RemoteComposable RemoteRowScope.() -> Unit
): Unit

The Wear Material SplitSwitchButton offers two slots and shows the current toggle state via a switch.

The RemoteSplitSwitchButton is essentially a RemoteRow with two split areas. The first area containing label and optional secondaryLabel is clickable and triggers onContainerClick. The second area contains a switch toggle control and triggers onCheckedChange.

import androidx.compose.remote.creation.compose.action.valueChange
import androidx.compose.remote.creation.compose.state.rememberMutableRemoteBoolean
import androidx.compose.remote.creation.compose.state.rs
import androidx.wear.compose.remote.material3.RemoteSplitSwitchButton
import androidx.wear.compose.remote.material3.RemoteText

val checked = rememberMutableRemoteBoolean(true)

RemoteSplitSwitchButton(
    checked = checked,
    onCheckedChange = valueChange(checked, !checked),
    toggleContentDescription = "Split Switch".rs,
    onContainerClick = valueChange(checked, !checked),
    modifier = modifier,
    label = { RemoteText("Split Switch".rs) },
)
Parameters
checked: RemoteBoolean

RemoteBoolean flag indicating whether this button is currently checked.

onCheckedChange: Action

Action to be invoked when the toggle control is clicked.

toggleContentDescription: RemoteString?

Text used by accessibility services to describe what this toggle control represents.

onContainerClick: Action

Action to be invoked when the container area is clicked.

modifier: RemoteModifier = RemoteModifier

RemoteModifier to be applied to the button.

enabled: RemoteBoolean = true.rb

Controls the enabled state of the button. When false, this button will appear visually disabled and will not be clickable. Note that only constant values are currently supported for enabled for click handling.

shape: RemoteShape = RemoteSplitSwitchButtonDefaults.shape

Defines the button's shape. It is recommended to use the default shape.

colors: RemoteSplitSwitchButtonColors = RemoteSplitSwitchButtonDefaults.splitSwitchButtonColors()

RemoteSplitSwitchButtonColors that will be used to resolve the container and content colors for this button in different states.

contentPadding: RemotePaddingValues = RemoteSplitSwitchButtonDefaults.ContentPadding

The spacing values to apply internally between the container and the content.

secondaryLabel: (@Composable @RemoteComposable RemoteRowScope.() -> Unit)? = null

A slot for a secondary label, displayed below the label.

label: @Composable @RemoteComposable RemoteRowScope.() -> Unit

A slot for the main label content.