Skip to content

Date Picker

A segmented date input with a button that opens a calendar in a popover: type the date, or pick it.

Styled with CSS Tailwind

Date picker

BitBhDatePicker is a date field — the segments type and step like BitBhDateField — whose BitBhDatePickerTrigger ("Choose date", aria-haspopup="dialog") opens BitBhDatePickerContent: a non-modal dialog anchored under the group, named by the field's label. Opening moves the focus to the selected date (or today) in the calendar; picking a date closes it and returns the focus to the button, as do Escape, a click outside and tabbing away. Alt+↓ in the segments opens it too.

mmddyyyy

Value: none

Date and time

BitBhDateTimePicker takes the same parts around a BitBhDateTimeField: the segments edit the date and the time (Granularity, HourCycle), and @bind-Value is a DateTime?. The calendar picks the date and keeps the time — the time typed, or midnight.

mmddyyyy––––AM

Value: none

Limits and unavailable dates

Min, Max and IsDateUnavailable go to the calendar (unless it is given its own): weekends here are unavailable and only the next three months can be picked. A typed date that breaks them is kept and marks the picker invalid (data-invalid, aria-invalid) — type a Saturday to see it.

mmddyyyy

Weekdays in the next three months.

Value: none

In a German form

The picker joins EditForm validation through @bind-Value; BitBhErrorMessage describes the group once invalid, and Name posts a hidden yyyy-MM-dd input. With a German Culture the segments read dd.MM.yyyy and the calendar starts its weeks on Monday.

ddmmyyyy
An unhandled error has occurred. Reload 🗙