Dynamic Form
Dynamic Form
A schema-driven form that renders the appropriate NeoUI input component for each field type, handles validation, and reports changes via callbacks.
Basic Contact Form
A flat schema rendered in a single column.
Two-Column Layout
Wide forms benefit from a multi-column grid.
Sections
Group related fields into collapsible sections.
Field Types Showcase
All supported FieldType values in a single form.
Validation
Required, min/max length, email, and custom validators with a summary.
Conditional Visibility
Fields appear or hide based on other field values using VisibleWhen expressions.
contactMethod: email
API Reference
DynamicForm and FormSchema parameters.
| Prop | Type | Default | Description |
|---|---|---|---|
| Schema | FormSchema? | null | Drives the form — sections, fields, and layout. |
| Values | Dictionary<string,object?> | new() | Current field values. Supports @bind-Values. |
| OnValidSubmit | EventCallback<Dictionary<…>> | Fires on submit when all validations pass. | |
| OnFieldChanged | EventCallback<FormFieldChangedEventArgs> | Fires whenever a single field changes. | |
| Columns | int | 1 | Default column count (overridden per schema/section). |
| ShowSubmitButton | bool | true | Renders the submit button at the bottom. |
| SubmitText | string | "Submit" | Label on the submit button. |
| ShowValidationSummary | bool | true | Shows an error summary at the top after first submit. |
| Disabled | bool | false | Disables all fields. |
FormFieldDefinition
| Prop | Type | Default | Description |
|---|---|---|---|
| Name | string | required | Key in the values dictionary. |
| Label | string? | null | Visible label above the field. |
| Description | string? | null | Helper text below the field. |
| Placeholder | string? | null | Input placeholder. |
| Type | FieldType | Text | Which input component to render. |
| Required | bool | false | Marks the field required. |
| Disabled | bool | false | Disables this specific field. |
| DefaultValue | object? | null | Value used when key is absent from Values. |
| ColSpan | int | 1 | How many grid columns this field spans. |
| VisibleWhen | string? | null | Condition expression e.g. "Field == 'value'". |
| Options | List<FormSelectOption>? | null | Options for Select/Radio/Checkbox-group fields. |
| Validations | List<FieldValidation>? | null | Validation rules applied on submit. |