Skip to main content

SwitchButton

Function SwitchButton 

Source
pub fn SwitchButton<F>(
    modifier: Modifier,
    spec: SwitchButtonSpec,
    checked: bool,
    label: String,
    secondary_label: Option<String>,
    on_checked_change: F,
) -> NodeId
where F: Fn(bool) + 'static,
Expand description

A switch row: a label, an optional secondary label, and a switch.

on_checked_change is handed the new value, matching Modifier.toggleable. It is unwrapped into a zero-argument callback for the node below because a composable’s callback parameters take no arguments — the macro re-installs them through an Fn().