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 TextInput, Select, DateInput, Check, MemoInput, 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<FieldsLabel>used to label the whole container and renders a<legend>whenGroupis enabled.
Groupturns<Field>or<Fields>into semantic group containers.In a grouped
<Field>,<FieldLabel>renders a<legend>.<FieldSet>and<Legend>remain available as simple native wrappers when you want to render those elements directly.
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.
<Field> is also the main semantic unit for forms in Blazorise. When a field contains one primary control together with
<FieldLabel>, <FieldHelp>, and validation feedback, Blazorise has enough context to keep visible form layout and
accessibility metadata aligned.
When a question is answered by multiple related controls, such as a RadioGroup or a set of checkboxes, prefer
enabling Group on <Field> or <Fields>. In a grouped <Field>,
<FieldLabel> renders a <legend>, and in a grouped <Fields> container,
<FieldsLabel> labels the whole set.
<Field>.
That keeps label, help, and validation associations unambiguous.
By default, Blazorise uses the <Field> structure to automatically render for on <FieldLabel> for
labelable controls, aria-labelledby for non-labelable controls such as RadioGroup, ColorPicker,
RichTextEdit, Markdown, and SignaturePad, aria-describedby from
<FieldHelp> and validation messages, and aria-invalid from validation state.
You can still override any association when needed with FieldLabel.For, AriaLabelledBy,
AriaDescribedBy, and AriaInvalid. Automatic accessibility integrations are enabled by default and can be controlled
globally through BlazoriseOptions.AccessibilityOptions.
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> <TextInput 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.
In a standard <Field>, <FieldLabel> can usually resolve the correct target automatically, so you only need
For for custom or ambiguous layouts.
<Field> <FieldLabel>Email address</FieldLabel> <TextInput 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> <TextInput> <FieldHelp>Include country and area prefixes</FieldHelp> </TextInput> </Field> <Field> <FieldLabel>Password</FieldLabel> <TextInput> <FieldHelp>Password strength: <Text TextColor="TextColor.Danger">weak</Text></FieldHelp> </TextInput> </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> <TextInput Value="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> <TextInput Value="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"> <TextInput 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"> <TextInput /> </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> <TextInput /> </Field> <Field ColumnSize="ColumnSize.Is4.OnDesktop"> <FieldLabel>State</FieldLabel> <Select TValue="string"> </Select> </Field> <Field ColumnSize="ColumnSize.Is2.OnDesktop"> <FieldLabel>Zip</FieldLabel> <TextInput /> </Field> </Fields>
Fields with Gutters
You can add gutters (spacing) between individual fields within a<Fields> container by setting the Gutter property. This helps improve readability and visual separation between related inputs.
<Fields Gutter="Gutter.Is1"> <Field ColumnSize="ColumnSize.Is6.OnDesktop"> <FieldLabel>City</FieldLabel> <TextInput /> </Field> <Field ColumnSize="ColumnSize.Is4.OnDesktop"> <FieldLabel>State</FieldLabel> <Select TValue="string"> </Select> </Field> <Field ColumnSize="ColumnSize.Is2.OnDesktop"> <FieldLabel>Zip</FieldLabel> <TextInput /> </Field> </Fields>
Grouped Field and Fields
EnableGroup on <Field> when one question is answered by a single grouped control such as <RadioGroup>.
Enable Group on <Fields> when multiple related <Field> components belong to the same section.
In grouped mode, <FieldLabel> or <FieldsLabel> becomes the semantic group label and supports RequiredIndicator and Screenreader.
<Field Group> <FieldLabel RequiredIndicator>Preferred contact method</FieldLabel> <RadioGroup TValue="string" Name="contact-method" @bind-Value=""> <Radio Value="@("email")">Email</Radio> <Radio Value="@("phone")">Phone</Radio> <Radio Value="@("sms")">SMS</Radio> </RadioGroup> </Field> <Div Margin="Margin.Is4.FromTop"> <Fields Group> <FieldsLabel>Shipping address</FieldsLabel> <Field> <FieldLabel>Street</FieldLabel> <TextInput Placeholder="1234 Main St" /> </Field> <Field> <FieldLabel>City</FieldLabel> <TextInput Placeholder="Zagreb" /> </Field> </Fields> </Div>
@code { string contactMethod = "email"; }
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> <TextInput 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.Use
Groupon<Field>or<Fields>when one label applies to a group of related controls instead of a single input.Keep
<FieldLabel>, the primary input,<FieldHelp>, and validation feedback in the same<Field>so Blazorise can generate the correct accessibility attributes automatically.
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.Don't keep a grouped radio or checkbox question in the default single-input mode when the label really belongs to the whole set.
Related components include <FieldLabel>, <FieldBody>, <FieldHelp>, <TextInput>, <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 |
Specifies the sizing configuration for the column, supporting responsive layouts and custom size definitions. |
IFluentColumn | null |
Group |
Determines whether the field should render as a semantic group container. |
bool | false |
Horizontal |
Determines whether the form controls should be aligned horizontally, as in a horizontal form layout. |
bool | false |
JustifyContent |
Specifies 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 |
Specifies the sizing configuration for the column, supporting responsive layouts and custom size definitions. |
IFluentColumn | null |
For |
Specifies 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 |
Specifies the visibility for screen readers. Possible values: |
Screenreader | Screenreader.Always |
FieldSet
| Parameter | Description | Type | Default |
|---|---|---|---|
ChildContent |
Specifies the content to render inside this FieldSet. RemarksUse this property to define custom child elements or components to be displayed within the column. |
RenderFragment | null |
ColumnSize |
Specifies the sizing configuration for the column, supporting responsive layouts and custom size definitions. |
IFluentColumn | null |
Horizontal |
Determines whether the enclosed controls should be aligned horizontally. |
bool | false |
Legend
| Parameter | Description | Type | Default |
|---|---|---|---|
ChildContent |
Specifies the content to render inside this Legend. RemarksUse this property to define custom child elements or components to be displayed within the column. |
RenderFragment | null |
ColumnSize |
Specifies the sizing configuration for the column, supporting responsive layouts and custom size definitions. |
IFluentColumn | null |
RequiredIndicator |
If defined, a required indicator will be shown next to the legend. |
bool | false |
Screenreader |
Makes an element hidden, but only visually, keeping it available for assistive technologies. 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 |
Specifies the sizing configuration for the column, supporting responsive layouts and custom size definitions. |
IFluentColumn | null |
Group |
Determines whether the fields container should render as a semantic group container. |
bool | false |
Gutter |
Specifies the padding between your columns, used to responsively space and align content in the Blazorise grid system. |
IFluentGutter | null |
Help |
Sets the field help-text positioned bellow the field. |
string | |
Label |
Sets the field label. |
string |
FieldsLabel
| Parameter | Description | Type | Default |
|---|---|---|---|
ChildContent |
Specifies the content to render inside this FieldsLabel. RemarksUse this property to define custom child elements or components to be displayed within the column. |
RenderFragment | null |
ColumnSize |
Specifies the sizing configuration for the column, supporting responsive layouts and custom size definitions. |
IFluentColumn | null |
RequiredIndicator |
If defined, a required indicator will be shown next to the label. |
bool | false |
Screenreader |
Specifies the visibility for screen readers. Possible values: |
Screenreader | Screenreader.Always |