pub fn fluid_switch() -> FluidSwitchBuilderExpand description
§fluid_switch
Render a fluid glass switch for prominent boolean toggles over visible surface-backed content.
§Usage
Use for settings or mode toggles where the moving glass lens is the primary interaction cue.
§Parameters
modifier- optional modifier chain applied to the switch subtree.on_toggle- optional callback invoked when the switch toggles.enabled- optional enabled state; defaults totrue.checked- optional external checked state. When omitted, the switch manages its own state internally.accent_color- optional checked-state tint blended into the surface substrate; defaults to a pale green.accessibility_label- optional accessibility label.accessibility_description- optional accessibility description.
§Examples
use tessera_components::{
fluid_switch::fluid_switch,
surface::surface,
theme::{MaterialTheme, material_theme},
};
let checked = tessera_ui::remember(|| false);
assert!(!checked.get());
material_theme()
.theme(|| MaterialTheme::default())
.child(move || {
surface().child(move || {
fluid_switch()
.checked(checked.get())
.on_toggle(move |next_checked| checked.set(next_checked));
});
});