Date component


A native date field example with type="date".

<DateEdit TValue="DateTime?" />


With bind attribute

By using bind-* attribute the selected date will be automatically assigned to the member variable.

<DateEdit TValue="DateTime?" @bind-Date="@selectedDate" />

    DateTime? selectedDate;

With event

When using the event DateChanged, you also must define the Date value attribute.

<DateEdit TValue="DateTime?" Date="@selectedDate" DateChanged="@OnDateChanged" />

    DateTime? selectedDate;

    void OnDateChanged( DateTime? date )
        selectedDate = date;


Name Type Default Description
Date DateTime? null Gets or sets the input date value.
DateChanged event   Occurs when the date has changed.
Min DateTime? null The earliest date to accept.
Max DateTime? null The latest date to accept.
Pattern string null The pattern attribute specifies a regular expression that the input element’s value is checked against on form submission.