SelectField

A dropdown select field for choosing a single option from a list. Options can be provided directly via the Options parameter or resolved from the field’s schema definition when used inside a FormBuilder.

Basic Usage

<ArcadiaForm Model="model">
    <SelectField Field="@nameof(Model.Country)"
                 Label="Country"
                 Placeholder="Select a country..."
                 Options="countryOptions" />
</ArcadiaForm>

@code {
    private List<FieldOption> countryOptions = new()
    {
        new FieldOption { Value = "us", Label = "United States" },
        new FieldOption { Value = "ca", Label = "Canada" },
        new FieldOption { Value = "uk", Label = "United Kingdom" }
    };
}

Parameters

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

Inherited from FieldBase

ParameterTypeDefaultDescription
Labelstring?nullVisible label displayed above the field.
Placeholderstring?nullPlaceholder text shown as the initial disabled option.
HelperTextstring?nullHelper text displayed below the field.
RequiredboolfalseWhether the field is required.
DisabledboolfalseWhether the field is disabled.
ErrorsIReadOnlyList<string>?nullValidation errors to display.
SchemaFieldSchema?nullField schema definition for dynamic form generation.

FieldOption

Each option in the list is a FieldOption with the following properties:

PropertyTypeDescription
ValuestringThe value submitted when this option is selected.
LabelstringThe display text shown to the user.
DisabledboolWhether this individual option is disabled.

Validation

public class ProfileModel
{
    [Required(ErrorMessage = "Please select a country.")]
    public string? Country { get; set; }
}

Accessibility

  • Label is linked to the select via for/id attributes.
  • Required fields set aria-required="true" and display a visual * indicator.
  • Validation errors are linked via aria-describedby and announced with role="alert".