MudForm API

Pages
Properties
Name Type Default Description
Validation
OverrideFieldValidation
bool?
null If a field already has a validation, override it with MudForm.Validation.
Validation
object
null A default validation func or a validation attribute to use for form controls that don't have one. 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
Validated data
ChildContent
RenderFragment
null Child content of component.
Model
object
null Specifies the top-level model object for the form. Used with Fluent Validation
Validation result
Errors
string[]
Validation error messages.
IsValid
bool
True Validation status. True if the form is valid and without errors. This parameter is two-way bindable.
Behavior
IsTouched
bool
False True if any field of the field was touched. This parameter is readonly.
SuppressImplicitSubmission
bool
True When true, will not cause a page refresh on Enter if any input has focus. https://www.w3.org/TR/2018/SPSD-html5-20180327/forms.html#implicit-submission Usually this is not wanted, as it can cause a page refresh in the middle of editing a form. When the form is in a dialog this will cause the dialog to close. So by default we suppress it.
SuppressRenderingOnValidation
bool
False When true, the form will not re-render its child contents on validation updates (i.e. when IsValid changes). This is an optimization which can be necessary especially for larger forms on older devices.
ValidationDelay
int
300 Validation debounce delay in milliseconds. This can help improve rendering performance of forms with real-time validation of inputs i.e. when textfields have Immediate="true".
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
ErrorsChanged EventCallback<string[]>
IsTouchedChanged EventCallback<bool> Raised when IsTouched changes.
IsValidChanged EventCallback<bool> Raised when IsValid changes.
Methods
Name Parameters Return Description
Dispose()
Reset() Reset all form controls and reset their validation state.
ResetValidation() Reset the validation state but keep the values.
Task Validate()
Task
Force a validation of all form controls, even if they haven't been touched by the user yet.
An unhandled error has occurred. Reload 🗙