RadioGroupField

A group of radio buttons wrapped in a <fieldset> with a <legend> for selecting a single option from a set of choices. Options can be provided directly or resolved from the field schema.

Basic Usage

<ArcadiaForm Model="model">
    <RadioGroupField Field="@nameof(Model.ContactMethod)"
                     Label="Preferred Contact Method"
                     Options="contactOptions" />
</ArcadiaForm>

@code {
    private List<FieldOption> contactOptions = new()
    {
        new FieldOption { Value = "email", Label = "Email" },
        new FieldOption { Value = "phone", Label = "Phone" },
        new FieldOption { Value = "mail", Label = "Mail" }
    };
}

Parameters

ParameterTypeDefaultDescription
Valuestring?nullThe value of the currently selected radio button. Supports two-way binding.
ValueChangedEventCallback<string?>Callback invoked when the user selects a different radio option.
OptionsList<FieldOption>?nullThe list of radio button options. When null, options are resolved from the field schema.

Inherited from FieldBase

ParameterTypeDefaultDescription
Labelstring?nullVisible label displayed as the fieldset legend.
HelperTextstring?nullHelper text displayed below the radio group.
RequiredboolfalseWhether a selection is required.
DisabledboolfalseWhether all radio buttons are disabled.
ErrorsIReadOnlyList<string>?nullValidation errors to display.
SchemaFieldSchema?nullField schema definition for dynamic form generation.

Validation

public class ContactModel
{
    [Required(ErrorMessage = "Please select a contact method.")]
    public string? ContactMethod { get; set; }
}

Accessibility

  • The radio group is wrapped in a <fieldset> with a <legend> for proper grouping.
  • Uses role="radiogroup" on the container.
  • Required groups set aria-required="true".
  • Individual options that are disabled (via FieldOption.Disabled) are also marked as disabled on the input.
  • Validation errors are linked via aria-describedby and announced with role="alert".