Skip to content

Pickers

DatePicker

Bit.BlazorUIMonthPickerYearPickerDateTimePicker

A BitDatePicker picks a date, or a date and time, from a drop-down or inline calendar with day, month and year views. It supports min/max, disabled and highlighted dates, typed input, any culture, calendar and time zone, and the WAI-ARIA combobox and grid keyboard patterns.

Styling

Appearance, CSS variables, cascading parameters, colors, icons, sizes, Style & Class and right-to-left pickers.

Appearance

Underlined, HasBorder, IconPlacement and IconName style the field, ShowGoToToday hides the today button, and DropDirection lets the callout open on any side.
  • Underlined draws only a bottom line under the field; HasBorder="false" removes the border entirely, for a field inside a surface of its own.
  • IconPlacement honours Start and End (the default) only; the side follows the reading direction. IconName picks a built-in icon (default CalendarMirrored); external icons are in External Icons.
  • The go-to-today button moves the calendar to today's month without selecting anything.
  • DropDirection defaults to TopAndBottom: the callout opens below the field, or above it when there is no room. All also lets it open to either side.











CSS variables

Every visual value reads a --bit-DatePicker-* variable: set one on :root to re-skin every picker, on an ancestor to re-skin the pickers inside it, or on Style to re-skin one. The callout keeps inheriting from the picker while it is open, so the field and the calendar change together. Styles.Callout targets the calendar alone. The variables restyle the default, not a choice: an explicit Color or Size wins over them for what it sets.



Cascading parameters

BitParams hands a BitDatePickerParams to every DatePicker inside it. The values are defaults, not overrides: a picker keeps whatever it sets itself.

Use it for the settings a whole form or app shares - the culture, the time zone, the week layout, the bounds, the texts of a translation. Every parameter of the DatePicker can be cascaded, along with ReadOnly, Required and the common ones (Disabled, Dir, Class, Style, ...), except what belongs to one instance: the value and its binding, IsOpen, the events, and Invalid, ErrorMessage and ErrorMessageTemplate. A cascaded ErrorMessageAriaLabel reaches every picker under it, so set it there only as a generic replacement for "Invalid input". Only the members of the BitDatePickerParams that are set (not null) are handed down.

Takes the week layout, the bounds and the clear button from the cascade:


So does this one, without repeating any of it:


Its own bounds and placeholder, the cascaded week layout:


Outside the cascade, and back to the defaults:

Color

Color (Primary by default) paints today, the highlighted current month and the selected AM/PM.

Left unset (null), the picker is primary unless the --bit-DatePicker-* today and focus color variables of the CSS variables section say otherwise; an explicit Color wins over those variables. The open field's border and the focus ring follow it too. The selected day keeps its own style.

































External Icons

Use icons from external libraries like FontAwesome, Material Icons, and Bootstrap Icons with the Icon parameter.

Every icon of the picker comes as a pair: a BitIconInfo parameter (Icon, ClearButtonIcon, PrevMonthNavIcon, NowButtonIcon, ...) for any icon font, and an ...IconName string for a built-in Fluent UI icon. The BitIconInfo one wins when both are set. Pass a string of CSS classes, or build it with BitIconInfo.Css, .Fa or .Bi. The library only adds the classes: the icon font's stylesheet has to be loaded by the app, as the link elements below do.


FontAwesome:






Bootstrap:






Navigation & TimePicker Icons (FontAwesome):





Navigation Icons (Bootstrap):

Size

Size scales the field, the calendar cells and the time picker together (Medium by default).

Left unset (null), the picker is medium unless the --bit-DatePicker-* size variables (label, input, icon, day, header and time sizes) say otherwise; an explicit Size wins over them. A larger size also widens the callout, so it falls back to fewer months and to overlay pickers on a slightly wider viewport.





Style & Class

Style and Class target the root; Styles and Classes target every part.

The callout is rendered beside the root and moved to the end of the page while it is open, so a selector written for the root's Class does not reach the calendar: style it through Classes.Callout / Styles.Callout or the parts inside it (DayButton, SelectedDayButton, TodayDayButton, ...). CSS variables set on Style do reach it. The Focused part applies while the field has the focus. A class from a scoped (.razor.css) stylesheet needs ::deep to reach the parts, the way this page's stylesheet does. Every part is listed in the BitDatePickerClassStyles table of the API.


Component's Style & Class:





Styles & Classes:


RTL

Dir="Rtl" mirrors the picker, including the arrow keys; an RTL culture (like fa-IR) does it automatically.

Left unset, the picker follows the direction of the page around it. The callout carries the direction with it while it is open, and the side the icon sits on (IconPlacement) and the left/right arrow keys follow the reading direction.

Feedback

Found a mistake, a gap, or something that could be clearer? Every page and every component is one click from its source.