Forms
TwSwitch
TwSwitch is a Blazor toggle switch component for on and off settings. Bind Value and set Color, Name, and disabled or readonly states.
Last updated
Basic Usage
A toggle switch for binary on/off state, bound with
@bind-Value.Notifications are on
Colors
Use
Color to give a switch meaning at a glance - here each toggle drives an independent, bound setting.Disabled & Readonly
Disabled dims and locks the switch; ReadOnly keeps its state and color but blocks changes.Settings Panel
A practical example - each switch binds to its own field, and a summary below reflects the combined state.
Active settings:
- Email notifications
Theme Configuration
Styling is controlled by
TwBlazorTheme.Components (a TwSwitchTheme), configured via the
AddTwBlazor() options callback described on the Get Started page.
Every property is a set of Tailwind classes, so changes are picked up by your own Tailwind build.
| Property | Type | Controls |
|---|---|---|
Switch |
string | |
Track |
string | |
WrapperSize |
string | |
Base |
string | |
LabelBase |
string | |
LabelInteractiveCursor |
string | |
LabelNonInteractiveCursor |
string | |
LabelDisabled |
string |
Global Theme Configuration
These reuse shared design tokens configured once on TwBlazorTheme, rather than being unique to this component.
| Property | Type | Controls |
|---|---|---|
Colors |
TwBlazorPalette |
Full reference: TwSwitchTheme on the API docs.