Default
Checked
Disabled
Checked + Disabled
Installation
CLI
Install the component using the StarUI CLI:
star add switchExamples
Switch with Label
Switch with label, helper text, and reactive feedback
Receive email and push notifications
Auto-save Feature
Document setting with status feedback
Document Settings
Configure how your document is saved
Automatically save changes as you type
Email Subscriptions
Dependent switches for email preferences
Email Preferences
Manage your email subscriptions
API Reference
Props
| Prop | Type | Default | Description |
|---|---|---|---|
checked |
bool | None |
None |
Initial checked state of the switch |
signal |
str |
auto-generated |
Datastar signal name for state management |
disabled |
bool |
False |
Whether the switch is disabled |
required |
bool |
False |
Whether the switch is required |
cls |
str |
'' |
Additional CSS classes |