Version v3 Documentation
You are viewing documentation for an older version.
View latest (v4) documentation →
Form Field Radio Group
A pre-composed form field that wraps a RadioGroup control with automatic label, helper text, and error message display. Inherits from FormFieldBase, which provides EditContext integration, auto-generated control IDs, ARIA attribute wiring, and validation error state management. Generic over TValue for the type of the selected value. Uses the CascadingTypeParameter attribute, so TValue propagates to child RadioGroupItem components automatically.
Default
A basic
FormFieldRadioGroup with string values. Provide RadioGroupItem components as ChildContent to define the radio options. Use the Label parameter on each item for automatic label rendering and accessibility wiring.
Loading example…
With Helper Text
Use
HelperText to provide guidance below the radio group. The helper text automatically hides when the field enters an error state.
Loading example…
With Error
Use
ErrorText to manually set a validation error. For EditForm integration, validation errors from DataAnnotationsValidator display automatically.
Loading example…
Disabled
Set
Disabled to true to prevent interaction with all radio options. Individual items can also be disabled using the Disabled parameter on RadioGroupItem.
Loading example…
Horizontal Layout
Set
Orientation to FieldOrientation.Horizontal to place the label beside the radio group. Combine with InputClass to control the inner layout of the radio items.
Loading example…
Custom Variant
Use
Class to style the outer field container and apply Tailwind CSS classes to the individual RadioGroupItem elements for custom accent colors. Wrap options in styled containers to create card-style radio selectors.
Loading example…
EditForm Validation
Inside an
EditForm, validation errors from DataAnnotationsValidator display automatically. Try submitting without selecting a theme.
Loading example…