Blazorise Field component
A flexible layout container used to organize and align form input components for better usability, accessibility, and structure.
The <Field> component acts as a lightweight form layout wrapper that groups a label, input control, help text, and validation message into a single, consistent container.
It works with common Blazorise form controls such as TextEdit, Select, DateEdit, Check, MemoEdit, and optionally Button.
Its structure is intentionally minimal, making it easy to build clear, predictable, and accessible form layouts.
<Field>the main container.<FieldLabel>used for the label of the field.<FieldBody>the container for the input control.<FieldHelp>used for the help text.
<Fields>container used to group severalFieldcomponents
It is recommended to always place input components inside of a Field. That way you will keep consistent spacing,
alignment, and arrangement between input controls across your forms.
Examples
Basic
To properly structure your form, wrap each input control inside aField component to keep labels, help text, and validation messages aligned consistently.
<Field> <TextEdit Placeholder="Name" /> </Field>
Label
Every input should have a clear, descriptive label that explains its purpose in plain language. Use<FieldLabel> to associate the label with the control, and FieldHelp when additional guidance is needed.
<Field> <FieldLabel>Email address</FieldLabel> <TextEdit Placeholder="Enter email" /> </Field>
Helper
Helper text provides inline guidance or additional context for a field. It can contain plain text, HTML, or other components and should clarify how to fill out the input without repeating the label.<Fields> <Field> <FieldLabel>Phone number</FieldLabel> <TextEdit> <FieldHelp>Include country and area prefixes</FieldHelp> </TextEdit> </Field> <Field> <FieldLabel>Password</FieldLabel> <TextEdit> <FieldHelp>Password strength: <Text TextColor="TextColor.Danger">weak</Text></FieldHelp> </TextEdit> </Field> </Fields>
Read-Only
Set a field as read-only when the value should be visible but not editable. Read-only inputs remain in the tab order, can receive focus, and their contents can still be selected and copied by the user.<Field> <FieldLabel>Read-Only</FieldLabel> <TextEdit Text="Value" ReadOnly /> </Field>
Disabled
Disable a field to mark it as unavailable when the user should not interact with it. Disabled inputs cannot receive focus or be edited.
Disabling a field is often preferable to hiding it because it preserves the layout and lets users see that the option exists, even if it is currently unavailable.
<Field> <FieldLabel>Disabled</FieldLabel> <TextEdit Text="Value" Disabled /> </Field>
Horizontal field
Use a horizontal field when you want the label and input to appear side-by-side in a single row. Combine <FieldLabel> and <FieldBody> with ColumnSize to control how much space each part occupies.
When using a <Check> component inside a horizontal field, align it with the label by applying Margin="Margin.IsAuto" or similar spacing utilities.
Note: Horizontal fields are inspired by Bootstrap horizontal form layout, and only one horizontal field should be placed per row to keep the grid aligned.
<Field Horizontal> <FieldLabel ColumnSize="ColumnSize.Is2">Name</FieldLabel> <FieldBody ColumnSize="ColumnSize.Is10"> <TextEdit Placeholder="Some text value..." /> </FieldBody> </Field> <Field Horizontal> <FieldLabel ColumnSize="ColumnSize.Is2">Check me</FieldLabel> <FieldBody ColumnSize="ColumnSize.Is10" Margin="Margin.IsAuto"> <Check TValue="bool" /> </FieldBody> </Field>
Visibility
Use theVisibility attribute to hide a field while still preserving its space in the layout, so surrounding content does not shift unexpectedly.
<Field Visibility="Visibility.Invisible"> <TextEdit /> </Field>
Fields
The<Fields> component is used to group multiple <Field> components. Use it to build rows or columns of related fields that share layout settings and spacing.
<Fields> <Field ColumnSize="ColumnSize.Is6.OnDesktop"> <FieldLabel>City</FieldLabel> <TextEdit /> </Field> <Field ColumnSize="ColumnSize.Is4.OnDesktop"> <FieldLabel>State</FieldLabel> <Select TValue="string"> </Select> </Field> <Field ColumnSize="ColumnSize.Is2.OnDesktop"> <FieldLabel>Zip</FieldLabel> <TextEdit /> </Field> </Fields>
Validation Indicator
In Blazorise, you can use theRequiredIndicator feature to automatically display an indicator (such as an asterisk) next to labels of required fields. This helps users quickly understand which inputs are mandatory and improves overall form usability.
<Field> <FieldLabel RequiredIndicator> Name </FieldLabel> <FieldBody> <TextEdit Placeholder="Name" /> </FieldBody> </Field>
Best Practices
Do
Use
<Field>to provide a consistent label, layout, and validation message for each form control.Use
<Field>to label controls that do not have built-in labels, such as<ProgressBar>or custom components.Use
<Fields>to group related<Field>components when building multi-column or sectioned form layouts.
Don't
Avoid combining a long validation message and extensive helper text in the same field, as this can overwhelm users.
Don't add multiple interactive controls as children of a single
<Field>. The label should clearly describe one primary control for better accessibility.
Related components include <FieldLabel>, <FieldBody>, <FieldHelp>, <TextEdit>, <Select>, and <Check>. Together they help you build accessible and visually consistent forms.
In summary, the <Field> component simplifies form layout in Blazorise by aligning labels, inputs, help text, and validation messages, while the <Fields> container lets you organize multiple fields into structured sections.
API
Parameters
Field
| Parameter | Description | Type | Default |
|---|---|---|---|
ChildContent |
Specifies the content to render inside this Field. RemarksUse this property to define custom child elements or components to be displayed within the column. |
RenderFragment | null |
ColumnSize |
Defines the sizing configuration for the column, supporting responsive layouts and custom size definitions. |
IFluentColumn | null |
Horizontal |
Determines whether the form controls should be aligned horizontally, as in a horizontal form layout. |
bool | false |
JustifyContent |
Defines how the container's items are aligned along the main axis when there is extra space available. Possible values: |
JustifyContent | JustifyContent.Default |
FieldLabel
| Parameter | Description | Type | Default |
|---|---|---|---|
ChildContent |
Specifies the content to render inside this FieldLabel. RemarksUse this property to define custom child elements or components to be displayed within the column. |
RenderFragment | null |
ColumnSize |
Defines the sizing configuration for the column, supporting responsive layouts and custom size definitions. |
IFluentColumn | null |
For |
Gets or sets the ID of an element that this label belongs to. |
string | |
RequiredIndicator |
If defined, a required indicator will be shown next to the label. |
bool | false |
Screenreader |
Defines the visibility for screen readers. Possible values: |
Screenreader | Screenreader.Always |
Fields
| Parameter | Description | Type | Default |
|---|---|---|---|
ChildContent |
Specifies the content to render inside this Fields. RemarksUse this property to define custom child elements or components to be displayed within the column. |
RenderFragment | null |
ColumnSize |
Defines the sizing configuration for the column, supporting responsive layouts and custom size definitions. |
IFluentColumn | null |
Help |
Sets the field help-text positioned bellow the field. |
string | |
Label |
Sets the field label. |
string |