Toggle

A two-state button that toggles between on and off.

Toggle

Outline

Use the outline variant for an outline style.

With Text

Size

Use the size prop to change the size of the toggle.

Disabled

Anatomy

Import all parts and piece them together.

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

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

API Reference

Toggle

A control that toggles between an on and off state.

Custom Attributes
NameTypeDefaultDescription
pressedboolfalse

A reactive signal coupled to the toggle's pressed state.

sizeString""

Specify the size to render the toggle.

variantString""

Specify the style of toggle to render.

Implements global and button attributes.