MudSwitch<T> API

Pages
Properties
Name Type Default Description
Data
Checked
T
null The state of the component
Validation
Error
bool
False If true, the label will be displayed in an error state.
ErrorId
string
null The ErrorId that will be used by aria-describedby if Error true
ErrorText
string
null The ErrorText that will be displayed if Error true.
For
Expression<Func<T>>
null Specify an expression which returns the model's field for which validation messages should be displayed.
Required
bool
False If true, this form input is required to be filled out.
RequiredError
string
"Required" The error text that will be displayed if the input is not filled out but required.
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<object, string, IEnumerable< string >> input Form.Model, Full Path of Member ... 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 Func<object, string, Task<IEnumerable< string >>> input Form.Model, Full Path of Member ... outputs all the returned error messages, no error if empty System.ComponentModel.DataAnnotations.ValidationAttribute instances
Behavior
ChildContent
RenderFragment
null
Converter
Converter<T, bool?>
The generic converter of the component.
Culture
CultureInfo
The culture of the component.
Disabled
bool
False If true, the input will be disabled.
Label
string
null The text/label will be displayed next to the switch if set.
LabelPosition
LabelPosition
LabelPosition.End The position of the text/label.
ReadOnly
bool
False If true, the input will be read-only.
StopClickPropagation
bool
True If true will prevent the click from bubbling up the event tree.
Appearance
Color
Color
Color.Default The color of the component. It supports the theme colors.
DisableRipple
bool
False If true, disables ripple effect.
ThumbIcon
string
null Shows an icon on Switch's thumb.
ThumbIconColor
Color
Color.Default The color of the thumb icon. Supports the theme colors.
UnCheckedColor
Color
Color.Default The base color of the component in its none active/unchecked state. It supports the theme colors.
Common
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.
EventCallbacks
Name Type Description
CheckedChanged EventCallback<T> Fired when Checked changes.
Methods
Name Parameters Return Description
string GetErrorText()
string : Error text/message
Return the validation error text or the conversion error message.
Reset() Reset the value and the validation.
ResetValidation() Reset the validation.
Task Validate()
Task
Cause this component to validate its value.
An unhandled error has occurred. Reload 🗙