Lumeo

Form

Structured form layout with labels, descriptions, and validation messages.

Installation

dotnet add package Lumeo

One-time app setup (AddLumeo(), CSS & JS) is covered in the installation guide.

Usage

@using Lumeo

<Form />

When to Use

  • Data collection forms such as registration, contact, or feedback forms
  • Settings pages with multiple fields that need labels and validation
  • Multi-field validation workflows like password changes or profile updates
  • Any form requiring consistent layout with labels, descriptions, and error messages

Validation Pattern

Lumeo form inputs (Input, Select, Checkbox, Switch, Textarea, and others) do not carry Label, Required, Error, or HelpText props directly. Instead, wrap any input in <FormField> to attach a label, helper text, required marker, and inline error message. The FormField cascades a FormFieldContext so that child <FormLabel> and <FormMessage> components automatically reflect the error state without any extra wiring.

We will never share your email.

Receive updates about your account.

Examples

This is your public display name.

We will never share your email.

Enter your email address.

At least 8 characters.

Reset to initial values

The Form component takes a snapshot of the model when it's first attached. Two reset methods are available:

  • Form.Reset() — clears errors, dirty fields, and submission state, but leaves the bound model values alone. Useful after a successful submit when you want to keep what the user typed but drop the validation overlay.
  • Form.ResetValues() — restores every property on the model to the snapshot taken at first render, then clears errors / dirty / submission state. The "Cancel changes" button on an edit form.

Snapshot timing. The snapshot is captured on first render against the model reference you passed. If you swap the entire model (e.g. _model = newOne), call Form.CaptureSnapshot() on the new model so the next ResetValues() restores to the right baseline.

API Reference

Form<TModel>

Prop Type Default Description
ModelTModel?nullThe form model object to validate.
ChildContentRenderFragment?nullForm fields and submit button.
OnValidSubmitEventCallback<TModel>Callback invoked when the form is submitted and validation passes.
OnInvalidSubmitEventCallback<TModel>Callback invoked when the form is submitted and validation fails.
ValidatorIFormValidator?nullCustom validator implementation for the form model.
Classstring?nullAdditional CSS classes.
AdditionalAttributesDictionary<string, object>?nullAdditional HTML attributes.

FormField

Prop Type Default Description
Labelstring?nullLabel text for the field.
HelpTextstring?nullHelper text shown below the input when there is no error.
Errorstring?nullError message. Turns the label red and displays below the input.
RequiredboolfalseShows a red asterisk next to the label.
OrientationLumeo.OrientationVerticalLayout orientation. Values: Vertical, Horizontal.
LabelWidthstring?nullWidth of the label column in horizontal orientation.
Namestring?nullField name identifier for validation.
ChildContentRenderFragment?nullInput elements for the field.
Classstring?nullAdditional CSS classes.
AdditionalAttributesDictionary<string, object>?nullAdditional HTML attributes.

FormItem

Prop Type Default Description
ChildContentRenderFragment?nullForm item content (label, input, description, message).
Classstring?nullAdditional CSS classes.
AdditionalAttributesDictionary<string, object>?nullAdditional HTML attributes.

FormLabel

Prop Type Default Description
ChildContentRenderFragment?nullLabel text. Turns red when the parent FormField has an error.
Classstring?nullAdditional CSS classes.
AdditionalAttributesDictionary<string, object>?nullAdditional HTML attributes.

FormDescription

Prop Type Default Description
ChildContentRenderFragment?nullHelper description text.
Classstring?nullAdditional CSS classes.
AdditionalAttributesDictionary<string, object>?nullAdditional HTML attributes.

FormMessage

Prop Type Default Description
Classstring?nullAdditional CSS classes.
AdditionalAttributesDictionary<string, object>?nullAdditional HTML attributes. Automatically displays the error from the parent FormField.
  • Input — For individual text input fields used within form fields
  • Select — For dropdown selection fields within forms
  • Checkbox — For boolean or multi-select options in forms
  • Button — For form submission and cancel actions