pub fn switch(args: impl Into<SwitchArgs>, state: SwitchState)Expand description
§switch
Convenience wrapper for switch_with_child that renders no thumb content.
§Usage
Use when you want a standard on/off switch without a custom icon.
§Parameters
args— configures sizing, colors, and callbacks; seeSwitchArgs.state— a clonableSwitchStatethat owns the checked state and animation.
§Examples
use std::sync::Arc;
use tessera_ui_basic_components::switch::{switch, SwitchArgsBuilder, SwitchState};
let switch_state = SwitchState::new(false);
switch(
SwitchArgsBuilder::default()
.on_toggle(Arc::new(|checked| {
assert!(checked || !checked);
}))
.build()
.unwrap(),
switch_state,
);