Examples
@bind-Value is a plain bool.
email=True · digest=False
Color maps to daisyUI's toggle-* colours.
Small, Medium and Large, plus Disabled and ReadOnly.
ChildContent replaces Label when the text needs markup.
Playground
<Switch
Label="Email notifications"
Value="true"
Color="Color.Primary" />API
<Switch>
DaisyBlazorParameters
- Checked bool= false
MudBlazor-style alias for Value; used when CheckedChanged is wired or set to true.
- Color Color= Color.Default
Theme color mapped to toggle-primary, toggle-accent, etc.; Default adds no color class.
- Disabled bool= false
Disables the input and ignores change events.
- Label string= null
Text rendered in a .label-text span next to the input.
- ReadOnly bool= false
Cancels clicks and ignores change events, so the toggle stays put and the state cannot be changed by the user.
- Size Size= Size.Medium
Input size: Small adds toggle-sm, Large adds toggle-lg; Medium uses the daisyUI default.
- Value bool= false
Whether the toggle is checked; two-way bindable with @bind-Value.
- Class string= null
Extra CSS classes merged onto the wrapping <label> element.
- Style string= null
Inline CSS style applied to the wrapping <label> element.
Events
- CheckedChanged EventCallback<
bool> MudBlazor-style alias for ValueChanged; wiring it makes Checked the source of truth.
- ValueChanged EventCallback<
bool> Raised with the new state when the user toggles the toggle.
Content
- ChildContent RenderFragment
Additional content rendered inside the label after the input and Label.
From MudSwitch
Switch keeps MudSwitch's parameter names, so most markup moves over by
dropping the Mud prefix. See the migration guide for the shared enums, icons and services.