Function freya_components::Switch
source · pub fn Switch<'a>(cx: Scope<'a, SwitchProps<'a>>) -> Element<'a>
Expand description
Controlled Switch
component.
Props
See SwitchProps
.
Styling
Inherits the SwitchTheme
theme.
Example
fn app(cx: Scope) -> Element {
let enabled = use_state(&cx, || false);
render!(
Switch {
enabled: *enabled.get(),
ontoggled: |_| {
enabled.set(!enabled.get());
}
}
)
}