A control that allows the user to toggle between checked and not checked.
use yew::prelude::*;
use crate::components::ui::{label::Label, switch::Switch};
#[function_component]
pub fn SwitchDemo() -> Html {
html! {
<div class="flex items-center space-x-2">
<Switch id="airplane-mode" />
<Label r#for="airplane-mode">{"Airplane Mode"}</Label>
</div>
}
}
use yew::prelude::*;
use crate::components::ui::{label::Label, switch::Switch};
#[function_component]
pub fn SwitchDemo() -> Html {
html! {
<div class="flex items-center space-x-2">
<Switch id="airplane-mode" />
<Label r#for="airplane-mode">{"Airplane Mode"}</Label>
</div>
}
}
The CLI is not yet available. For now, manually copy the component source into your project.
rust-shadcn-ui add switch
use yew::prelude::*;
use crate::components::ui::switch::Switch;
#[component]
fn Usage() -> impl IntoView {
view! {
<Switch />
}
}
use yew::prelude::*;
// use crate::components::ui::switch::Switch;
#[function_component]
pub fn SwitchForm() -> Html {
html! {
// TODO
}
}
use yew::prelude::*;
// use crate::default::components::ui::switch::Switch;
#[function_component]
pub fn SwitchForm() -> Html {
html! {
// TODO
}
}