CheckboxGroupField

A group of checkboxes wrapped in a <fieldset> with a <legend> for selecting multiple options from a set. Each checkbox can be independently toggled, and the component tracks the selected values as a List<string>.

Basic Usage

<ArcadiaForm Model="model">
    <CheckboxGroupField Field="@nameof(Model.Interests)"
                        Label="Interests"
                        Options="interestOptions" />
</ArcadiaForm>

@code {
    private List<FieldOption> interestOptions = new()
    {
        new FieldOption { Value = "tech", Label = "Technology" },
        new FieldOption { Value = "sports", Label = "Sports" },
        new FieldOption { Value = "music", Label = "Music" },
        new FieldOption { Value = "travel", Label = "Travel" }
    };
}

Parameters

ParameterTypeDefaultDescription
ValuesList<string>new()The list of currently checked option values. Supports two-way binding.
ValuesChangedEventCallback<List<string>>Callback invoked whenever a checkbox is checked or unchecked.
OptionsList<FieldOption>?nullThe list of available checkbox 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 checkbox group.
RequiredboolfalseWhether at least one selection is required.
DisabledboolfalseWhether all checkboxes are disabled.
ErrorsIReadOnlyList<string>?nullValidation errors to display.
SchemaFieldSchema?nullField schema definition for dynamic form generation.

Validation

public class PreferencesModel
{
    [MinLength(1, ErrorMessage = "Select at least one interest.")]
    public List<string> Interests { get; set; } = new();
}

Accessibility

  • The checkbox group is wrapped in a <fieldset> with a <legend> for proper grouping.
  • Uses role="group" 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".