Class RadzenDatePicker<TValue>
A date and time picker component that provides a calendar popup for selecting dates and optional time selection. RadzenDatePicker supports DateTime, DateTime?, DateTimeOffset, DateTimeOffset?, DateOnly, and DateOnly? types with extensive customization options. Displays a text input with a calendar icon button. Clicking opens a popup calendar for date selection. Optional time selection can be enabled via ShowTime property, supporting both 12-hour and 24-hour formats. Supports features like min/max date constraints, disabled dates, initial view configuration, calendar week display, inline calendar mode (always visible), time-only mode, multiple date selection, and culture-specific formatting.
Inherited Members
Namespace: Radzen.Blazor
Assembly: Radzen.Blazor.dll
Syntax
public class RadzenDatePicker<TValue> : RadzenComponent, IComponent, IHandleEvent, IHandleAfterRender, IDisposable, IRadzenFormComponent
Type Parameters
| Name | Description |
|---|---|
| TValue | The type of the date/time value. Supports DateTime, DateTime?, DateTimeOffset, DateTimeOffset?, DateOnly, and DateOnly?. |
Examples
Basic date picker:
<RadzenDatePicker @bind-Value=@birthDate TValue="DateTime" Placeholder="Select date" />
Date and time picker with 12-hour format:
<RadzenDatePicker @bind-Value=@appointmentDate TValue="DateTime" ShowTime="true" TimeOnly="false" HoursStep="1" MinutesStep="15" />
Date picker with constraints:
<RadzenDatePicker @bind-Value=@selectedDate TValue="DateTime" Min="@DateTime.Today" Max="@DateTime.Today.AddMonths(6)" />
Constructors
RadzenDatePicker()
Initializes a new instance of the RadzenDatePicker<TValue> class.
Declaration
public RadzenDatePicker()
Fields
input
Gets input reference.
Declaration
protected ElementReference input
Field Value
| Type | Description |
|---|---|
| ElementReference |
Properties
AllowClear
Gets or sets a value indicating whether value can be cleared.
Declaration
[Parameter]
public bool AllowClear { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
|
AllowInput
Gets or sets a value indicating whether input is allowed.
Declaration
[Parameter]
public bool AllowInput { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
|
ButtonClass
Gets or sets the button CSS class.
Declaration
[Parameter]
public string ButtonClass { get; set; }
Property Value
| Type | Description |
|---|---|
| string | The button CSS class. |
CalendarWeekTitle
Gets or sets the previous month aria label text.
Declaration
[Parameter]
public string CalendarWeekTitle { get; set; }
Property Value
| Type | Description |
|---|---|
| string | The previous month aria label text. |
Change
Gets or sets the change callback.
Declaration
[Parameter]
public EventCallback<DateTime?> Change { get; set; }
Property Value
| Type | Description |
|---|---|
| EventCallback<DateTime?> | The change callback. |
CurrentDateChanged
Gets or set the current date changed callback.
Declaration
[Parameter]
public EventCallback<DateTime> CurrentDateChanged { get; set; }
Property Value
| Type | Description |
|---|---|
| EventCallback<DateTime> |
CurrentPlaceholder
Gets the current placeholder. Returns empty string if this component is inside a RadzenFormField.
Declaration
protected string CurrentPlaceholder { get; }
Property Value
| Type | Description |
|---|---|
| string |
DateFormat
Gets or sets the date format.
Declaration
[Parameter]
public string DateFormat { get; set; }
Property Value
| Type | Description |
|---|---|
| string | The date format. |
DateRender
Gets or sets the date render callback. Use it to set attributes.
Declaration
[Parameter]
public Action<DateRenderEventArgs> DateRender { get; set; }
Property Value
| Type | Description |
|---|---|
| Action<DateRenderEventArgs> | The date render callback. |
Disabled
Gets or sets a value indicating whether this RadzenDatePicker<TValue> is disabled.
Declaration
[Parameter]
public bool Disabled { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
|
EditContext
Gets or sets the edit context.
Declaration
[CascadingParameter]
public EditContext EditContext { get; set; }
Property Value
| Type | Description |
|---|---|
| EditContext | The edit context. |
FieldIdentifier
Gets the field identifier.
Declaration
[Parameter]
public FieldIdentifier FieldIdentifier { get; set; }
Property Value
| Type | Description |
|---|---|
| FieldIdentifier | The field identifier. |
FooterTemplate
Gets or sets the footer template.
Declaration
[Parameter]
public RenderFragment FooterTemplate { get; set; }
Property Value
| Type | Description |
|---|---|
| RenderFragment | The footer template. |
Form
Gets or sets the form.
Declaration
[CascadingParameter]
public IRadzenForm Form { get; set; }
Property Value
| Type | Description |
|---|---|
| IRadzenForm | The form. |
FormFieldContext
Gets or sets the FormFieldContext of the component
Declaration
[CascadingParameter]
public IFormFieldContext FormFieldContext { get; set; }
Property Value
| Type | Description |
|---|---|
| IFormFieldContext |
FormattedValue
Gets the formatted value.
Declaration
public string FormattedValue { get; }
Property Value
| Type | Description |
|---|---|
| string | The formatted value. |
HasValue
Gets a value indicating whether this instance has value.
Declaration
public bool HasValue { get; }
Property Value
| Type | Description |
|---|---|
| bool |
|
HourFormat
Gets or sets the hour format.
Declaration
[Parameter]
public string HourFormat { get; set; }
Property Value
| Type | Description |
|---|---|
| string | The hour format. |
HoursStep
Gets or sets the hours step.
Declaration
[Parameter]
public string HoursStep { get; set; }
Property Value
| Type | Description |
|---|---|
| string | The hours step. |
InitialViewDate
Gets or sets the Initial Date/Month View.
Declaration
[Parameter]
public DateTime? InitialViewDate { get; set; }
Property Value
| Type | Description |
|---|---|
| DateTime? | The Initial Date/Month View. |
Inline
Gets or sets a value indicating whether this RadzenDatePicker<TValue> is inline - only Calender.
Declaration
[Parameter]
public bool Inline { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
|
InputAttributes
Specifies additional custom attributes that will be rendered by the input.
Declaration
[Parameter]
public IReadOnlyDictionary<string, object> InputAttributes { get; set; }
Property Value
| Type | Description |
|---|---|
| IReadOnlyDictionary<string, object> | The attributes. |
InputClass
Gets or sets the input CSS class.
Declaration
[Parameter]
public string InputClass { get; set; }
Property Value
| Type | Description |
|---|---|
| string | The input CSS class. |
IsBound
Gets a value indicating whether this instance is bound (ValueChanged callback has delegate).
Declaration
public bool IsBound { get; }
Property Value
| Type | Description |
|---|---|
| bool |
|
Kind
Gets or sets the kind of DateTime bind to control
Declaration
[Parameter]
public DateTimeKind Kind { get; set; }
Property Value
| Type | Description |
|---|---|
| DateTimeKind |
Max
Gets or sets the Maximum Selectable Date.
Declaration
[Parameter]
public DateTime? Max { get; set; }
Property Value
| Type | Description |
|---|---|
| DateTime? | The Maximum Selectable Date. |
Min
Gets or sets the Minimum Selectable Date.
Declaration
[Parameter]
public DateTime? Min { get; set; }
Property Value
| Type | Description |
|---|---|
| DateTime? | The Minimum Selectable Date. |
MinutesStep
Gets or sets the minutes step.
Declaration
[Parameter]
public string MinutesStep { get; set; }
Property Value
| Type | Description |
|---|---|
| string | The minutes step. |
Multiple
Gets or sets whether multiple dates can be selected. When enabled, users can select multiple dates from the calendar, and the value will be a collection of DateTimes.
Declaration
[Parameter]
public bool Multiple { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
|
Name
Gets or sets the name of the form component.
Declaration
[Parameter]
public string Name { get; set; }
Property Value
| Type | Description |
|---|---|
| string | The name. |
NextMonthAriaLabel
Gets or sets the next month aria label text.
Declaration
[Parameter]
public string NextMonthAriaLabel { get; set; }
Property Value
| Type | Description |
|---|---|
| string | The next month aria label text. |
OkAriaLabel
Gets or sets the OK button aria label text.
Declaration
[Parameter]
public string OkAriaLabel { get; set; }
Property Value
| Type | Description |
|---|---|
| string | The OK button aria label text. |
PadHours
Gets or sets a value indicating whether the hour picker is padded with a leading zero.
Declaration
[Parameter]
public bool PadHours { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
|
PadMinutes
Gets or sets a value indicating whether the minute picker is padded with a leading zero.
Declaration
[Parameter]
public bool PadMinutes { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
|
PadSeconds
Gets or sets a value indicating whether the second picker is padded with a leading zero.
Declaration
[Parameter]
public bool PadSeconds { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
|
ParseInput
Parse the input using an function outside the Radzen-library
Declaration
[Parameter]
public Func<string, DateTime?> ParseInput { get; set; }
Property Value
| Type | Description |
|---|---|
| Func<string, DateTime?> |
Placeholder
Gets or sets the input placeholder.
Declaration
[Parameter]
public string Placeholder { get; set; }
Property Value
| Type | Description |
|---|---|
| string | The input placeholder. |
PopupRenderMode
Gets or sets the render mode.
Declaration
[Parameter]
public PopupRenderMode PopupRenderMode { get; set; }
Property Value
| Type | Description |
|---|---|
| PopupRenderMode | The render mode. |
PrevMonthAriaLabel
Gets or sets the previous month aria label text.
Declaration
[Parameter]
public string PrevMonthAriaLabel { get; set; }
Property Value
| Type | Description |
|---|---|
| string | The previous month aria label text. |
ReadOnly
Gets or sets a value indicating whether read only.
Declaration
[Parameter]
public bool ReadOnly { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
|
SecondsStep
Gets or sets the seconds step.
Declaration
[Parameter]
public string SecondsStep { get; set; }
Property Value
| Type | Description |
|---|---|
| string | The seconds step. |
ShowButton
Gets or sets a value indicating whether popup datepicker button is shown.
Declaration
[Parameter]
public bool ShowButton { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
|
ShowCalendarWeek
Gets or sets whether the calendar week number column should be displayed in the calendar popup. When enabled, each week row shows its corresponding week number according to ISO 8601.
Declaration
[Parameter]
public bool ShowCalendarWeek { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
|
ShowDays
Gets or sets a value indicating whether days part is shown.
Declaration
[Parameter]
public bool ShowDays { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
|
ShowHour
Gets or sets a value indicating whether hour is shown.
Declaration
[Parameter]
public bool ShowHour { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
|
ShowInput
Gets or sets a value indicating whether the input box is shown. Ignored if ShowButton is false.
Declaration
[Parameter]
public bool ShowInput { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
|
ShowMinutes
Gets or sets a value indicating whether minutes are shown.
Declaration
[Parameter]
public bool ShowMinutes { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
|
ShowSeconds
Gets or sets a value indicating whether seconds are shown.
Declaration
[Parameter]
public bool ShowSeconds { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
|
ShowTime
Gets or sets a value indicating whether time part is shown.
Declaration
[Parameter]
public bool ShowTime { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
|
ShowTimeOkButton
Gets or sets a value indicating whether time ok button is shown.
Declaration
[Parameter]
public bool ShowTimeOkButton { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
|
TabIndex
Gets or sets the tab index.
Declaration
[Parameter]
public int TabIndex { get; set; }
Property Value
| Type | Description |
|---|---|
| int | The tab index. |
TimeOnly
Gets or sets a value indicating whether time only can be set.
Declaration
[Parameter]
public bool TimeOnly { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
|
ToggleAmPmAriaLabel
Gets or sets the toggle Am/Pm aria label text.
Declaration
[Parameter]
public string ToggleAmPmAriaLabel { get; set; }
Property Value
| Type | Description |
|---|---|
| string | The toggle Am/Pm aria label text. |
ToggleAriaLabel
Gets or sets the toggle popup aria label text.
Declaration
[Parameter]
public string ToggleAriaLabel { get; set; }
Property Value
| Type | Description |
|---|---|
| string | The toggle popup aria label text. |
Value
Gets or sets the value.
Declaration
[Parameter]
public object Value { get; set; }
Property Value
| Type | Description |
|---|---|
| object | The value. |
ValueChanged
Gets or sets the value changed callback.
Declaration
[Parameter]
public EventCallback<TValue> ValueChanged { get; set; }
Property Value
| Type | Description |
|---|---|
| EventCallback<TValue> | The value changed callback. |
ValueExpression
Gets or sets the value expression.
Declaration
[Parameter]
public Expression<Func<TValue>> ValueExpression { get; set; }
Property Value
| Type | Description |
|---|---|
| Expression<Func<TValue>> | The value expression. |
YearFormat
Gets ot sets the year format. Set to yyyy by default.
Declaration
[Parameter]
public string YearFormat { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
YearFormatter
Gets or sets the year formatter. Set to FormatYear by default.
If set, this function will take precedence over YearFormat.
Declaration
[Parameter]
public Func<int, string> YearFormatter { get; set; }
Property Value
| Type | Description |
|---|---|
| Func<int, string> |
YearRange
Gets or sets the year range.
Declaration
[Parameter]
public string YearRange { get; set; }
Property Value
| Type | Description |
|---|---|
| string | The year range. |
Methods
BuildRenderTree(RenderTreeBuilder)
A date and time picker component that provides a calendar popup for selecting dates and optional time selection. RadzenDatePicker supports DateTime, DateTime?, DateTimeOffset, DateTimeOffset?, DateOnly, and DateOnly? types with extensive customization options. Displays a text input with a calendar icon button. Clicking opens a popup calendar for date selection. Optional time selection can be enabled via ShowTime property, supporting both 12-hour and 24-hour formats. Supports features like min/max date constraints, disabled dates, initial view configuration, calendar week display, inline calendar mode (always visible), time-only mode, multiple date selection, and culture-specific formatting.
Declaration
protected override void BuildRenderTree(RenderTreeBuilder __builder)
Parameters
| Type | Name | Description |
|---|---|---|
| RenderTreeBuilder | __builder |
Overrides
Close()
Closes this instance popup.
Declaration
public void Close()
Dispose()
Detaches event handlers and disposes Reference.
Declaration
public override void Dispose()
Overrides
FocusAsync()
Sets the focus.
Declaration
public ValueTask FocusAsync()
Returns
| Type | Description |
|---|---|
| ValueTask | A ValueTask representing the asynchronous operation. |
GetComponentCssClass()
Gets the component CSS class.
Declaration
protected override string GetComponentCssClass()
Returns
| Type | Description |
|---|---|
| string |
Overrides
GetValue()
Gets the value.
Declaration
public object GetValue()
Returns
| Type | Description |
|---|---|
| object | System.Object. |
OnAfterRenderAsync(bool)
Called by the Blazor runtime.
Declaration
protected override Task OnAfterRenderAsync(bool firstRender)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | firstRender |
Returns
| Type | Description |
|---|---|
| Task |
Overrides
OnInitialized()
Called by the Blazor runtime.
Declaration
protected override void OnInitialized()
Overrides
ParseDate()
Parses the date.
Declaration
protected Task ParseDate()
Returns
| Type | Description |
|---|---|
| Task |
SetParametersAsync(ParameterView)
Called by the Blazor runtime when parameters are set.
Declaration
public override Task SetParametersAsync(ParameterView parameters)
Parameters
| Type | Name | Description |
|---|---|---|
| ParameterView | parameters | The parameters. |
Returns
| Type | Description |
|---|---|
| Task |