Date & time

DatePickerControl · TimePickerControl · DateRangePickerControl · CalendarControl · TimeSpanPickerControl

Type it or pick it: dates with a calendar drop-down, times from a stepped list, ranges, multi-day selections and durations.

Overview

DatePickerControl is a text box that parses what you type (sixteen built-in date formats, more with ShowTime) and opens a calendar on the 📅 button, F4 or Enter on an empty field. TimePickerControl is an editable drop-down of times from Min to Max every Step. DateRangePickerControl pairs two date pickers with a range calendar in a popup, and CalendarControl is that calendar on its own, in single, multiple or range mode. TimeSpanPickerControl is a row of number boxes for a duration. All five bind their value two ways and report validation through EditContext when used inside an EditForm.

Examples

#Date, time and duration

MinDate greys out the past; ShowCalendarSidebar adds Today, Tomorrow and week shortcuts to the drop-down. The time list runs 8:00 to 18:00 in half hours, and typed times outside it are refused with the control's own message. The duration commits when a box loses focus.

Example
Razor
C#
Date
Start
Duration
h
m

Tue 20 Oct 2026, 9:30 AM – 11:00 AM

#Date range

One CalendarRange binds both pickers and the popup calendar. Min and Max bound the hire window. Put the end before the start and the control reports it; the bound value still updates, so the page can refuse to count nights.

Example
Razor
C#

3 day hire, Mon 26 Oct to Thu 29 Oct

#Calendar, several dates

SelectionMode="Multiple" toggles days into Values. DisabledDate greys out weekends, FirstDayOfWeek starts the grid on Monday, and the heading button switches to a year or decade view. Arrow keys move through the days.

Example
Razor
C#
MonTueWedThuFriSatSun

3 site visits: Tue 20 Oct, Thu 22 Oct, Mon 26 Oct

Documentation

DatePickerControl parameters

ParameterTypeDefaultDescription
ValueDateTime?nullSelected date, or date and time with ShowTime. Two-way with @bind-Value.
ValueChangedEventCallback<DateTime?>—Fires when typed text parses (Enter or blur) or a day is picked.
ValueExpressionExpression<Func<DateTime?>>?nullSet by @bind-Value; marks the field changed on the cascaded EditContext.
Formatstring?"MM/dd/yyyy" (with time: "MM/dd/yyyy hh:mm tt")Display format. Typed text is tried against this first, then the built-in list.
Placeholderstring?the formatInput placeholder.
ShowTimeboolfalseAdds a time box to the drop-down and time formats to parsing.
MinDate / MaxDateDateTime?nullDays outside are disabled in the calendar and rejected when typed.
ShowCalendarSidebarboolfalseExpandable sidebar of shortcuts: Today, Yesterday, Tomorrow, Start and End of Week, Next Week, Start and End of Month, Clear Date.
ParseFormatsIEnumerable<string>?nullExtra formats tried before the sixteen built-in ones (ISO, US, day-month, dd-MMM-yy, digit runs).
CultureCultureInfo?currentParsing and formatting culture.
ShowTriggerButtonbooltrueShows the 📅 button. Without it Enter on an empty field no longer opens the calendar.
OpenCalendarOnDoubleClickboolfalseDouble-click in the input opens the calendar.
AutoFocusboolfalseFocuses the input once after first render.
AriaLabelstring?nullAccessible name of the input.
ValidationChangedEventCallback<string?>—Fires with the parse message, or null when the text is valid again.
Enabled / Visible / Id / CssClass / Style (base)—All honoured on the host.
Grid-cell hosting—OpenOnRender, InitialText, Uncontrolled, InputValueChanged, ElementReferenceCaptured, OnKeyDown, CalendarButtonKeyDown serve the grid's cell editor; see the source comments before using them in a form.

TimePickerControl parameters

ParameterTypeDefaultDescription
ValueTimeOnly?nullSelected time. Two-way with @bind-Value.
ValueChangedEventCallback<TimeOnly?>—Fires when a list entry is chosen or typed text parses on Enter.
ValueExpressionExpression<Func<TimeOnly?>>?nullSet by @bind-Value; validation messages go to the EditContext.
Min / MaxTimeOnly00:00 / 23:59:59.9999999First and last entry; typed times outside are refused.
StepTimeSpan30 minutesGap between entries. At least one second, and at most 1441 entries, or the control throws.
Formatstring"hh:mm tt"Display and parse format; free-form input is also tried with the culture's parser.
CultureCultureInfocurrentFormatting culture.
Widthstring?nullCSS width of the drop-down.
AriaLabelstring?nullAccessible name of the input.
ValidationChangedEventCallback<string?>—Fires with the error text, or null once valid.
OnKeyDownEventCallback<KeyboardEventArgs>—Raw key events from the input.
Enabled / Visible (base)booltrueHonoured.

DateRangePickerControl parameters

ParameterTypeDefaultDescription
ValueCalendarRange(null, null)Start and end; either may be null. Two-way with @bind-Value.
ValueChangedEventCallback<CalendarRange>—Fires after either picker or the popup calendar changes the range, even when it is invalid.
ValueExpressionExpression<Func<CalendarRange>>?nullSet by @bind-Value; the error goes to the EditContext.
Min / MaxDateTime?nullBounds for both dates. Min after Max throws.
DisabledDateFunc<DateTime,bool>?nullDays that cannot be inside the range.
AriaLabelstring"Date range"Accessible name of the group.
Enabled (base)booltruefalse disables the pickers and the Choose range button.

CalendarControl parameters

ParameterTypeDefaultDescription
Value / ValueChangedDateTime?nullSelection in Single mode.
Values / ValuesChangedIReadOnlyList<DateTime>emptySelection in Multiple mode; a click toggles the day and the list is kept sorted.
Range / RangeChangedCalendarRange(null, null)Selection in Range mode: first click sets the start, second the end; a click before the start swaps them.
SelectionModeCalendarSelectionModeSingleSingle, Multiple or Range.
Min / MaxDateTime?nullDays outside are disabled and the month buttons stop there.
DisabledDateFunc<DateTime,bool>?nullExtra disabled days. A range that would cross one is refused.
CultureCultureInfocurrentDay names, month names and the default first day.
FirstDayOfWeekDayOfWeek?nullOverrides the culture's first day.
DisplayDate / DisplayDateChangedDateTime?value or todayMonth on show. Changes when the user navigates.
View / ViewChangedCalendarViewMonthMonth, Year (pick a month) or Decade (pick a year). The heading button cycles them.
ShowTodayButtonbooltrueRenders a Today button under the grid.
DayTemplateRenderFragment<CalendarCellContext>?nullCustom day cell; receives CalendarCellContext.
Enabled / Visible / Id (base)—Honoured.

TimeSpanPickerControl parameters

ParameterTypeDefaultDescription
ValueTimeSpan?nullDuration. Two-way with @bind-Value; null shows zeros.
ValueChangedEventCallback<TimeSpan?>—Fires when a box commits (blur or Enter), not per keystroke.
ShowDaysboolfalseAdds a days box (0 or more).
ShowSecondsboolfalseAdds a seconds box (0–59).
DisabledboolfalseDisables the boxes. The base Enabled and Visible are not read by this control.
(unmatched attributes)Dictionary<string,object>—Forwarded to the host <div>.

CalendarRange and CalendarCellContext

PropertyTypeDefaultDescription
CalendarRange.Start / EndDateTime?—Either bound may be null. Positional record: new(start, end), update with with.
CalendarCellContextrecord—Date, Selected, Disabled, InCurrentMonth: what a DayTemplate receives.

Methods and read-only properties

MethodInputsReturnsDescription
DatePickerControl.FocusAsync()—TaskFocuses the input.
TimePickerControl.FocusAsync()—TaskFocuses the drop-down's input.
TimePickerControl.ErrorMessage—string?Current parse or bounds message, or null.
DateRangePickerControl.SetValueAsync()rangeTaskValidates order, bounds and disabled days, publishes the error and raises ValueChanged.
DateRangePickerControl.Error—string?Current message, or null.
CalendarControl.NavigateAsync()directionTaskMoves one period back (−1) or forward (+1) in the current view.
CalendarControl.SelectAsync()dateTaskSame as clicking the day: honours the selection mode and disabled days.

CSS classes

ClassEffect
fx-datepicker-host · -input-group · -input · -triggerHost, the input row, the text box and the 📅 button. -input-group-no-trigger when the button is hidden.
fx-datepicker-dropdown · -popup-layer · -backdrop · -validation-pillThe calendar (expanded or minimal with the sidebar), its top-layer wrapper, the click-away backdrop and the error pill.
fx-calendar-main · fx-calendar-sidebar · fx-shortcut-btnDrop-down month panel, shortcut sidebar and its buttons.
fx-timepicker · fx-timepicker-errorHost around the drop-down list and the error line.
fx-date-range · fx-range-errorFlex row of the two pickers, the Choose range button and the error.
fx-calendar · -header · -cells · -row · -cellStandalone calendar; cells take selected, today and outside.
fx-timespan-picker · -segment · -input · -unitBordered row of number boxes with unit letters; disabled greys it.

CSS variables

VariableFallbackPurpose
--fx-border · --fx-surface · --fx-text · --fx-primary#cbd5e1 · #fff · #202630 · #2563ebRead by CalendarControl for its frame, background, text and the selected day.
--fx-zoom1Scales the date picker's drop-down.
(none)—The time, range and time span pickers read no variables.

Keyboard and accessibility

Keyboard: date picker input

KeyAction
F4 / Alt+Arrow DownOpen or close the calendar.
EnterParse the typed text. On an empty field, open the calendar instead.
EscapeClose the calendar; typed text stays for correction.
Arrow keys (calendar open)Left and Right move a day, Up and Down a week.
Page Up / Page DownPrevious or next month; with Shift, a year.
Home / EndFirst or last day of the focused week.
Enter / Space (calendar open)Select the focused day.

Keyboard: calendar grid

KeyAction
Arrow keysMove the focused day; disabled days are skipped and the month follows.
Page Up / Page DownSame day in the previous or next month; with Shift, year.
Home / EndFirst or last day of the week, honouring FirstDayOfWeek.
Enter / SpaceSelect the focused day (a native button).
  • The date input carries aria-label, aria-expanded and aria-invalid; the 📅 button is named "Toggle calendar". A parse error renders in a role="alert" pill with aria-live="assertive".
  • The time picker's error and the range picker's error are role="alert". The range picker is a role="group" whose inputs are named "Start date" and "End date".
  • The calendar is a role="grid" with column headers and aria-selected cells. Each day is a button named with the full date; one day holds the Tab stop and the arrows move it.
  • The time span boxes have no label beyond the unit letters d, h, m, s; put a visible label before the control.
An unhandled error has occurred. Reload 🗙

Rejoining the server...

Rejoin failed... trying again in seconds.

Failed to rejoin.
Please retry or reload the page.

The session has been paused by the server.

Failed to resume the session.
Please retry or reload the page.