Blazor Date Picker Component Overview
The Blazor Date Picker component allows the user to choose a date from a visual list (calendar) or to type it into a date input that can accept only dates. You can control the format shown in the input, how the user navigates through the calendar, and dates the user cannot select.
The Date Picker component is part of Telerik UI for Blazor, a
professional grade UI library with 75+ native components for building modern and feature-rich applications. To try it out sign up for a free 30-day trial.
To use a Telerik Date Picker for Blazor, add the TelerikDatePicker
tag.
Basic date picker with namespace and reference
The selected date is: @datePickerValue.ToShortDateString()
<br />
<TelerikDatePicker @bind-Value="datePickerValue" @ref="theDatePicker"></TelerikDatePicker>
@code {
DateTime datePickerValue { get; set; } = DateTime.Now;
Telerik.Blazor.Components.TelerikDatePicker<DateTime> theDatePicker;
// the type of the component depends on the type of the value
// in this case it is DateTime, but it could be DateTime?
}
Features
The Blazor Date Picker component exposes the following features:
BottomView
- Defines the bottommost view in the popup calendar to which the user can navigate to. Defaults toCalendarView.Month
.DisabledDates
- Specifies a list of dates that can not be selected.Class
- The custom CSS class rendered on the wrapping element.PopupClass
- additional CSS class to customize the appearance of the Date Picker's dropdown.Enabled
- Specifies whether typing in the input is allowed.Format
- Specifies the format of the DateInput of the DatePicker. Read more about supported data formats in Telerik DateInput for Blazor UI article.Id
- renders as theid
attribute on the<input />
element, so you can attach a<label for="">
to the input.Min
- The earliest date that the user can select.Max
- The latest date that the user can select.PopupHeight
- Defines the height of the DatePicker's Popup. Defaults toauto
.PopupWidth
- Defines the width of the DatePicker's Popup. Defaults toauto
.Value
- The current value of the input. Can be used for binding.View
- Specifies the current view that will be displayed in the popup calendar.Width
- Defines the width of the DatePicker. Defaults to280px
.TabIndex
- maps to thetabindex
attribute of the HTML element. You can use it to customize the order in which the inputs in your form focus with theTab
key.Validation - see the Input Validation article.
The date picker is, essentially, a date input and a calendar and the properties it exposes are mapped to the corresponding properties of these two components. You can read more about their behavior in the respective components' documentation.