Compose Component

SwitchButton

The Wear Material SwitchButton offers three slots and a specific layout for an icon, a label, and a secondaryLabel.

SwitchButton social preview

SwitchButtonSample

@Sampled
@Preview
@Composable
fun SwitchButtonSample() {
    var checked by remember { mutableStateOf(true) }
    SwitchButton(
        label = { Text("Switch Button", maxLines = 3, overflow = TextOverflow.Ellipsis) },
        secondaryLabel = {
            Text("With secondary label", maxLines = 2, overflow = TextOverflow.Ellipsis)
        },
        checked = checked,
        onCheckedChange = { checked = it },
        icon = { Icon(Icons.Filled.Favorite, contentDescription = "Favorite icon") },
        enabled = true,
    )
}
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: