DateRangeField

A paired date input field for selecting a date range with separate start and end date pickers. Wrapped in a <fieldset> with a <legend>, it supports customizable sub-labels for each date input.

Basic Usage

<ArcadiaForm Model="model">
    <DateRangeField Field="@nameof(Model.StartDate)"
                    Label="Booking Period"
                    @bind-StartDate="model.StartDate"
                    @bind-EndDate="model.EndDate" />
</ArcadiaForm>

Custom Labels

<DateRangeField Label="Stay"
                StartLabel="Check-in"
                EndLabel="Check-out"
                @bind-StartDate="model.CheckIn"
                @bind-EndDate="model.CheckOut" />

Parameters

ParameterTypeDefaultDescription
StartDateDateTime?nullThe beginning of the selected date range. Supports two-way binding.
StartDateChangedEventCallback<DateTime?>Callback invoked when the user changes the start date.
EndDateDateTime?nullThe end of the selected date range. Supports two-way binding.
EndDateChangedEventCallback<DateTime?>Callback invoked when the user changes the end date.
StartLabelstring"Start"The visible label for the start date input.
EndLabelstring"End"The visible label for the end date input.

Inherited from FieldBase

ParameterTypeDefaultDescription
Labelstring?nullVisible label displayed as the fieldset legend.
HelperTextstring?nullHelper text displayed below the date range.
RequiredboolfalseWhether the start date is required.
DisabledboolfalseWhether both date inputs are disabled.
ErrorsIReadOnlyList<string>?nullValidation errors to display.
SchemaFieldSchema?nullField schema definition for dynamic form generation.

Validation

public class BookingModel
{
    [Required(ErrorMessage = "Start date is required.")]
    public DateTime? StartDate { get; set; }

    [Required(ErrorMessage = "End date is required.")]
    public DateTime? EndDate { get; set; }
}

Accessibility

  • Wrapped in a <fieldset> with a <legend> for proper grouping.
  • Each date input has its own <label> linked via for/id attributes.
  • The separator text “to” is hidden from assistive technologies with aria-hidden="true".
  • Required fields set aria-required="true" on the start date input.
  • Validation errors are linked via aria-describedby and announced with role="alert".