Blazorise TimeEdit component
A native time input component build around the <input type="time">
.
Examples
Basic
A native time field example withtype="time"
.
<TimeEdit TValue="TimeSpan?" />
Binding
Two-way binding
By usingbind-*
attribute the selected time will be automatically assigned to the member variable.
<TimeEdit TValue="TimeSpan?" @bind-Time="" />
@code{
TimeSpan? selectedTime;
}
Manual event binding
When using the eventTimeChanged
, you also must define the Time
value attribute.
<TimeEdit TValue="TimeSpan?" Time="" TimeChanged="" />
@code{ TimeSpan? selectedTime; Task OnTimeChanged( TimeSpan? Time ) { selectedTime = Time; return Task.CompletedTask; } }
Show Picker
If you want to show the default picker that comes with the time input element you can make it by using the ShowPicker()
function.
Note: Keep in mind that not all browser will support the ShowPicker()
function.
<Field> <Button Color="Color.Primary" Clicked="@(()=>timeEditRef.ShowPicker())"> Show Picker </Button> </Field> <Field> <TimeEdit @ref="" TValue="DateTime" /> </Field>
@code {
TimeEdit<DateTime> timeEditRef;
}
Functions
Name | Description |
---|---|
ShowPicker() |
Show a browser picker for the time input. |