Examples
A bound order form; the record below echoes every field as you edit.
Order { Name = Ana Silva, Email = , Plan = Pro, Newsletter = False }
Validate() checks Required and each field's Validation func and binds IsValid; fields re-check as you edit them.
Validator turns the browser's :invalid state into daisyUI colours and reveals its hint after the user touches the field.
email= · invoice=inv-2041
ServerValidation cascades an error set; fields with a FieldName and any FieldError pick their message up.
API
<Form>
DaisyBlazorParameters
- IsValid bool= true
True when every registered field passed its last check. Updated by Validate() and by field edits; bind with @bind-IsValid.
- Model object= null
The object passed to a form-level Validation of shape Func<object, string, IEnumerable<string>> (model, FieldName).
- Validation object= null
Validation applied to every field that has no Validation of its own. Same shapes as a field's Validation, plus Func<object, string, IEnumerable<string>> called with (Model, FieldName).
- Class string= null
Extra CSS classes merged onto the root element.
- Style string= null
Inline CSS styles applied to the root element.
Events
- IsValidChanged EventCallback<
bool> Raised when IsValid changes.
Content
- ChildContent RenderFragment
Form fields rendered inside a vertical flex container with gap-3.
<Validator>
DaisyBlazorParameters
- Hint string= null
Optional hint rendered after the inputs as a .validator-hint paragraph, shown once an input is invalid.
- Class string= null
Extra CSS classes applied to the outer wrapper (around the inputs and the hint).
- Style string= null
Inline CSS styles applied to the outer wrapper.
Content
- ChildContent RenderFragment
The input element(s) to validate, wrapped in a .validator element.
<ValidatorHint>
DaisyBlazorParameters
- Class string= null
Extra CSS classes merged onto the .validator-hint paragraph.
- Style string= null
Inline CSS styles applied to the paragraph.
Content
- ChildContent RenderFragment
The hint message content to display beneath a validated input.
<ServerValidation>
DaisyBlazor.ValidationParameters
- State ServerValidationState= required
The error set to cascade. Usually a field on the page, reused across submits.
Content
- ChildContent RenderFragment
The form (or any markup) whose inputs should react to State.
<FieldError>
DaisyBlazor.ValidationParameters
- For string= required
Field name to report errors for. Matched case-insensitively, and against the last dot-separated segment, so request.Name matches Name.
- Class string= null
Extra CSS classes appended to each message.
- Style string= null
Optional inline style applied to each message.
From MudForm
Form keeps MudForm's parameter names, so most markup moves over by
dropping the Mud prefix. See the migration guide for the shared enums, icons and services.
Validate(), IsValid/IsValidChanged, Required/RequiredError and field Validation funcs (Func<T, string?>, Func<T, bool>, Func<T, IEnumerable<string>>) work as in MudForm on TextField, NumericField and Select. Validation is synchronous, For expressions are ignored, and a form-level Validation of shape Func<object, string, IEnumerable<string>> receives Model and the field's FieldName. ResetAsync() clears errors but not values.