Switch

A control that allows the user to toggle between checked and not checked.

Checkbox Group

Since a Switch is a Checkbox underneath, it can also be used in a CheckboxGroup.

Value: [ "recents", "home", "applications", ]

Sidebar

Select the items you want to display in the sidebar.

Anatomy

Import all parts and piece them together.

use leptos::prelude::*;
use singlestage::Switch;

#[component]
pub fn SwitchAnatomy() -> impl IntoView {
    view! { <Switch /> }
}

API Reference

switch

A control that allows the user to toggle between checked and not checked.

Custom Attributes
NameTypeDefaultDescription
checkedReactive<bool>false

A reactive signal coupled to the switch's checked value.

Implements global, input, and checkbox attributes.