Glass Switch
pub fn glass_switch(
args: impl Into<GlassSwitchArgs>,
state: GlassSwitchState,
)The glass_switch component is a glass-style switch that toggles between on and off states. It is the glass variant of the switch component. The component supports configuring background color, border, refraction, dispersion, and more, and provides click interaction.
Arguments
args: impl Into<GlassSwitchArgs>This argument configures the style of the glass_switch component, including size, color, border, etc. Use
GlassSwitchArgsBuilderto construct it.state: GlassSwitchStateThis argument manages the state of the glass_switch component, including whether it is currently on or off.
GlassSwitchStateis a clonable struct that encapsulates a shared reference to the state internally. You can create an initial state withGlassSwitchState::new(bool). Usestate.toggle()to toggle the switch state.
Preview
