Composable Function

RemoteSwitchButton

The Wear Material RemoteSwitchButton offers four slots and a specific layout for an icon, a label, a secondaryLabel and a switch toggle control.

RemoteSwitchButtonSample

@Sampled
@RemoteComposable
@Composable
@WearPreviewDevices
@PreviewWrapper(RemoteComponentPreviewWrapper::class)
public fun RemoteSwitchButtonSample(modifier: RemoteModifier = RemoteModifier) {
    val checked = remember { MutableRemoteBoolean(true) }

    RemoteSwitchButton(
        checked = checked,
        onCheckedChange = valueChangeAction(checked, !checked),
        modifier = modifier,
        label = { RemoteText("Switch".rs) },
    )
}
Jetpack Compose beyond MaterialFree components, screens and templates for apps that don’t look like Google’s. Copy them into your app, or let your coding agent add them.Browse for free

Content updated: