HxInputDateRange

Date range picker. Form input component for entering start date and end date.

Basic Usage

<HxInputDateRange Label="Absence" @bind-Value="@value" />

@code {
	private DateTimeRange value { get; set; }
}

Buttons in calendar

The Clear and OK buttons in calendars can be hidden by setting ShowCalendarButtons="false".

Custom ranges

Dropdown calendars customization

You can change rendering of weekend days by defining your own CSS rule for .weekend class. The disabled days get .disabled class.

MinDate, MaxDate

You can limit the dropdown calendars (both From and To together) enabled dates by setting MinDate and/or MaxDate.

Calendars date customization

You can customize the dropdown calendars' dates with CalendarDateCustomizationProvider. You can disable individual dates (Enabled="false") or set specific CSS class (CssClass="...").

API

Parameters

Name Type Description
UseDefaultDateRanges bool When true, uses default date ranges (this month, last month, this year, last year).
CustomDateRanges IEnumerable<DateRangeItem> Custom date ranges. When UseDefaultDateRanges is true, these items are used with default items.
InputSize InputSize?
FromParsingErrorMessage string Gets or sets the error message used when displaying an a "from" parsing error. Used with String.Format(...), {0} is replaced by Label property, {1} name of bounded property.
ToParsingErrorMessage string Gets or sets the error message used when displaying an a "to" parsing error. Used with String.Format(...), {0} is replaced by Label property, {1} name of bounded property.
ShowCalendarButtons bool? Indicates whether the Clear and OK buttons in calendars should be visible.
Default is true (configurable in HxInputDateRange.Defaults).
MinDate DateTime? First date selectable from the dropdown calendar.
Default is 1.1.1900 (configurable from HxInputDateRange.Defaults).
MaxDate DateTime? Last date selectable from the dropdown calendar.
Default is 31.12.2099 (configurable from HxInputDateRange.Defaults).
CalendarDateCustomizationProvider CalendarDateCustomizationProviderDelegate Allows customization of the dates in dropdown calendars.
Default customization is configurable with HxInputDateRange.Defaults.
Label string Label to render before input (or after input for Checkbox).
LabelTemplate RenderFragment Label to render before input (or after input for Checkbox).
Hint string Hint to render after input as form-text.
HintTemplate RenderFragment Hint to render after input as form-text.
CssClass string Custom CSS class to render with wrapping div.
LabelCssClass string Custom CSS class to render with the label.
InputCssClass string Custom CSS class to render with the input element.
ShowValidationMessage bool When false, validation message is not rendered. Default is true.
GenerateChip bool When true, HxChipGenerator is used to generate chip item(s). Default is true.
ChipTemplate RenderFragment Chip template.
Enabled bool? When null (default), the Enabled value is received from cascading FormState. When value is false, input is rendered as disabled. To set multiple controls as disabled use HxFormState.
AdditionalAttributes IReadOnlyDictionary<string, object>
Value DateTimeRange
ValueExpression Expression<Func<DateTimeRange>>
DisplayName string

Event Callbacks

Name Type Description
ValueChanged EventCallback<DateTimeRange>

Methods

Method Returns Description
FocusAsync() ValueTask Gives focus to the input element.

Static properties

Property Type Description
DefaultDateRanges List<DateRangeItem>
Defaults InputDateRangeDefaults Application-wide defaults for the HxInputDateRange.
An unhandled error has occurred. Reload 🗙