Toggle

A two-state button that can be either on or off.

Bold is

Installation

CLI

Install the component using the StarUI CLI:

star add toggle

Examples

Feature Toggles

Enable/disable features with descriptive toggles

Feature Flags

Enable experimental features

Enable beta features

Show debug information

Optimize for speed

Size Variations

Small, default, and large toggle sizes

Small

Default

Large

Social Interactions

Like, comment, save, and share toggles

Beautiful sunset over the mountains

Posted 2 hours ago

Music Player Simulation

Simulated music player with realistic timer and toggle controls

Now Playing

Sunset Dreams - Ambient Mix

Disabled States

Disabled toggles in different states

Enabled

Disabled

API Reference

Props

Prop Type Default Description
variant Literal['default','outline'] 'default' Visual style variant
size Literal['default','sm','lg'] 'default' Button size
pressed bool False Initial pressed state
signal str auto-generated Datastar signal (auto-generated if blank)
disabled bool False Disable the toggle
aria_label str | None None ARIA label for accessibility
cls str '' Additional CSS classes