Switch
rust
pub fn switch(args: impl Into<SwitchArgs>, state: Arc<RwLock<SwitchState>>)The switch component displays a toggle that can switch between on and off states.
Arguments
args: impl Into<SwitchArgs>This argument configures the style of the
switchcomponent, including size, color, border, and other properties. You can useSwitchArgsBuilderto construct it.state: Arc<RwLock<SwitchState>>This argument manages the state of the
switchcomponent, including whether it is currently on or off. You can create an initial state withSwitchState::new(bool). Use theSwitchState::toggle(&mut self)method to toggle the switch state.
Preview
