at main 28 lines 857 B view raw
1use dioxus::prelude::*; 2use dioxus_primitives::switch::{self, SwitchProps, SwitchThumbProps}; 3 4#[component] 5pub fn Switch(props: SwitchProps) -> Element { 6 rsx! { 7 document::Link { rel: "stylesheet", href: asset!("./style.css") } 8 switch::Switch { 9 class: "switch", 10 checked: props.checked, 11 default_checked: props.default_checked, 12 disabled: props.disabled, 13 required: props.required, 14 name: props.name, 15 value: props.value, 16 on_checked_change: props.on_checked_change, 17 attributes: props.attributes, 18 {props.children} 19 } 20 } 21} 22 23#[component] 24pub fn SwitchThumb(props: SwitchThumbProps) -> Element { 25 rsx! { 26 switch::SwitchThumb { class: "switch-thumb", attributes: props.attributes, {props.children} } 27 } 28}