Mudblazor

Community Support

Discord

Gitter

Tools and resources

TryMudBlazor

Templates

Sponsor

Open Collective


Switch to Blazor wasm
Toggle light/dark theme
GitHub repository
Toggle right-to-left/left-to-right

Community Support

Discord

Gitter

Tools and resources

TryMudBlazor

Templates

Sponsor

Open Collective

MudSwitch<T>

API documentation.

Check out the Examples for this component.

Properties

Name Type Default Description
Color Color Color.Default The color of the component. It supports the theme colors.
Label String null The text/label will be displayed next to the switch if set.
DisableRipple Boolean False If true, disables ripple effect.
ChildContent RenderFragment null
Disabled Boolean False If true, the input will be disabled.
ReadOnly Boolean False If true, the input will be read only.
Checked T null The state of the component
CheckedChanged EventCallback<T> Fired when Checked changes.
Required Boolean False If true, this form input is required to be filled out.
RequiredError String "Required" Set an error text that will be displayed if the input is not filled out but required!
ErrorText String null The ErrorText that will be displayed if Error true
Error Boolean False If true, the label will be displayed in an error state.
Converter Converter<T, Nullable<Boolean>>
Culture CultureInfo
Validation Object null A validation func or a validation attribute. Supported types are: Func<T, bool> ... will output the standard error message "Invalid" if false Func<T, string> ... outputs the result as error message, no error if null Func<T, IEnumerable< string >> ... outputs all the returned error messages, no error if empty Func<T, Task< bool >> ... will output the standard error message "Invalid" if false Func<T, Task< string >> ... outputs the result as error message, no error if null Func<T, Task<IEnumerable< string >>> ... outputs all the returned error messages, no error if empty System.ComponentModel.DataAnnotations.ValidationAttribute instances
For Expression<Func<T>> null Specify an expression which returns the model's field for which validation messages should be displayed. Currently only string fields are supported.
Class String null User class names, separated by space
Style String null User styles, applied on top of the component's own classes and styles
Tag Object null Use Tag to attach any user data object to the component for your convenience.
UserAttributes Dictionary<String, Object> UserAttributes carries all attributes you add to the component that don't match any of its parameters. They will be splatted onto the underlying HTML tag.
An error has occurred. This application may no longer respond until reloaded. Reload 🗙