Forms
TwTimePicker
TwTimePicker is a Blazor time picker component with 12 hour and 24 hour formats. Bind Value or SelectedTime, and set Placeholder and Variant.
Last updated
Basic time picker
Bind
SelectedTime for a TimeOnly value, or Value for a plain string.@bind-SelectedTime (TimeOnly): 10:14 PM
@bind-Value (string): 22:14
Input variants
The DatePicker supports different visual variants for the input field.
12hr time picker
Set
Is12HourFormat to display and enter time in a 12-hour format.@bind-SelectedTime (TimeOnly): 10:14 PM
Step
Set
Step to the number of minutes the panel's arrow buttons and the Arrow Up/Arrow Down keys move by. Under an hour, the minutes step (15 gives :00, :15, :30 and :45). From 60 upwards, the hours step instead (120 moves two hours at a time) and the minutes are shown as fixed text with no arrow buttons. The step must divide an hour (1, 2, 3, 4, 5, 6, 10, 12, 15, 20 or 30) or be a whole number of hours that divides a day (60, 120, 180, 240, 360, 480 or 720). A time typed into the field is kept as entered. When the browser's native picker is used, the step is passed on to it.Dense time picker
Set
Dense for a more compact input with a smaller height and text size. Every single-line input shares the same dense height, so they line up when used side by side.RAZOR
<TwTimePicker Id="dense-timepicker" @bind-SelectedTime="SelectedTime" Label="Dense Time Picker" Dense />Disabled and readonly time picker
Use the
Disabled and ReadOnly properties to restrict interaction with the time picker.RAZOR
<div class="space-y-4">
<TwTimePicker Id="disabled-timepicker" @bind-SelectedTime="SelectedTime" Label="Disabled Time Picker" Disabled />
<TwTimePicker Id="readonly-timepicker" @bind-SelectedTime="SelectedTime" Label="Readonly Time Picker" ReadOnly />
</div>Theme configuration
Styling is controlled by
TwBlazorTheme.Components (a TwTimePickerTheme), configured via the
AddTwBlazor() options callback described on the Get Started page.
Every property is a set of Tailwind classes, so changes are picked up by your own Tailwind build.
| Property | Type | Controls |
|---|---|---|
PickerRoot |
string | |
IconWrapper |
string | |
IconGlyph |
string | |
TextfieldPadding |
string | |
NativeInputAppearance |
string | |
PanelWrapper |
string | |
RangeStageTabsContainer |
string | |
RangeStageTabInactive |
string | |
StageTabActive |
string | |
StageTabHover |
string | |
StageTabBase |
string | |
BodySurface |
string | |
BodyRoot |
string | |
BodyInner |
string | |
ContentRow |
string | |
Column |
string | |
StepButton |
string | |
NumberWrapper |
string | |
NumberInput |
string | |
Separator |
string | |
AmPmWrapper |
string | |
AmPmButtonClass |
string | |
ColumnLabel |
string | |
Spinner |
string | |
AmPmOptionActive |
string | |
AmPmOptionInactive |
string | |
Actions |
string | |
ActionButton |
string |
Full reference: TwTimePickerTheme on the API docs.