Skip to main content
twblazor
Home
  • Get started
  • Tailwind with Blazor
  • Why twblazor?
  • Theme
  • Class Merge
    • Configuring localization
    • RTL Provider
  • Breadcrumb
  • Card
  • Carousel
  • Collapse
  • Context Menu
  • Drawer
  • Footer
  • Menu
  • Navbar
  • On This Page
  • Separator
  • Sidebar
  • Stepper
  • Tabs
  • Tree List
  • Container
  • Flex
  • Grid
  • Text
  • Link
  • Button
  • Form
    • AutocompleteNew
    • Checkbox
    • Color Picker
    • Date Picker
    • Date Range Picker
    • Datetime Picker
    • Datetime Range Picker
    • File Upload
    • Input GroupNew
    • NumericNew
    • Masked InputNew
    • Radio Button
    • Range SliderNew
    • RatingNew
    • Select
    • Slider
    • Switch
    • Tag InputNew
    • Text EditorNew
    • Textfield
    • Time Picker
    • Time Range Picker
  • Toggle
  • Toggle Group
  • Alert
  • Avatar
  • Badge
  • Chip
  • Empty
  • Icon
  • Popover
  • Progress
  • Skeleton
  • Spinner
  • Tooltip
  • Data Table
  • SpreadsheetNew
  • Column Filter Editor
  • Pagination
  • Pick List
  • Barcode
  • QR Code
  • Calendar
  • Table
  • Attachment
  • Overview
    • Bar
    • Bullet
    • Column
    • Dot Plot
    • Dumbbell
    • Icon
    • Lollipop
    • Radial Bar
    • Range
    • Word Cloud
    • Area
    • Bump
    • Bump Area
    • Candlestick
    • Gantt
    • Horizon
    • Line
    • Slope
    • Small Multiples
    • Stream Graph
    • Funnel
    • Gauge
    • Marimekko
    • Nightingale
    • Pie
    • Treemap
    • Waffle
    • Waterfall
    • Circular Treemap
    • Convex Treemap
    • Dendrogram
    • Sunburst
    • Barcode
    • Beeswarm
    • Box Plot
    • Density Plot
    • Histogram
    • Radial Histogram
    • Ridgeline
    • Strip Plot
    • Violin Plot
    • Categorical Scatter
    • Contour
    • Hexagonal Binning
    • Quadrant
    • Scatter
    • Heatmap
    • Matrix
    • Parallel Coordinates
    • Radar
    • Arc Diagram
    • Chord Diagram
    • Flowchart
    • Network Diagram
    • Sankey
    • Euler Diagram
    • Venn Diagram
  • Bubble
  • Marker
  • Message
  • Dialog Service
  • Toast Service
API DocumentationAI Agents & Skills
Home Get Started

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 16 October 2026

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

RAZOR
<div class="space-y-4">
    <p><b>@@bind-SelectedTime (TimeOnly):</b> @SelectedTime.ToString()</p>
    <TwTimePicker Id="basic-timepicker" @bind-SelectedTime="SelectedTime" @bind-Value="SelectedTimeTextValue" Label="Select a time" Class="mt-3" />
    <p><b>@@bind-Value (string):</b> @SelectedTimeTextValue</p>
    <TwTimePicker Id="basic-timepicker-string" @bind-Value="SelectedTimeTextValue" Label="Select a time" Class="mt-3" />
</div>
CSHARP
@code {
    public TimeOnly SelectedTime { get; set; } = TimeOnly.FromDateTime(DateTime.Now);
    public string SelectedTimeTextValue { get; set; } = TimeOnly.FromDateTime(DateTime.Now).ToString("HH:mm");
}

Input variants

The DatePicker supports different visual variants for the input field.
RAZOR
<div class="space-y-4">
    <TwTimePicker Id="default-variant" @bind-SelectedTime="SelectedTime" Label="Default Variant" Variant="InputVariant.Default" />
    <TwTimePicker Id="outlined-variant" @bind-SelectedTime="SelectedTime" Label="Outlined Variant" Variant="InputVariant.Outlined" />
    <TwTimePicker Id="filled-variant" @bind-SelectedTime="SelectedTime" Label="Filled Variant" Variant="InputVariant.Filled" />
</div>
CSHARP
@code {
    public TimeOnly SelectedTime { get; set; } = TimeOnly.FromDateTime(DateTime.Now);
    public string SelectedTimeTextValue { get; set; } = TimeOnly.FromDateTime(DateTime.Now).ToString("HH:mm");
}

12hr time picker

Set Is12HourFormat to display and enter time in a 12-hour format.

@bind-SelectedTime (TimeOnly): 10:14 PM

RAZOR
<p><b>@@bind-SelectedTime (TimeOnly):</b> @SelectedTime.ToString()</p>
<TwTimePicker Id="basic-12hr-timepicker" @bind-SelectedTime="SelectedTime" Label="Select a time" Class="mt-3" Is12HourFormat />
CSHARP
@code {
    public TimeOnly SelectedTime { get; set; } = TimeOnly.FromDateTime(DateTime.Now);
    public string SelectedTimeTextValue { get; set; } = TimeOnly.FromDateTime(DateTime.Now).ToString("HH:mm");
}

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.
RAZOR
<div class="space-y-4">
    <TwTimePicker Id="step-15-timepicker" @bind-SelectedTime="SelectedTime" Label="Every 15 minutes" Step="15" />
    <TwTimePicker Id="step-120-timepicker" @bind-SelectedTime="SelectedTime" Label="Every 2 hours" Step="120" />
</div>
CSHARP
@code {
    public TimeOnly SelectedTime { get; set; } = TimeOnly.FromDateTime(DateTime.Now);
    public string SelectedTimeTextValue { get; set; } = TimeOnly.FromDateTime(DateTime.Now).ToString("HH:mm");
}

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>

Keyboard navigation

Type a time straight into the field, or open the panel. The panel does not open just because the field has focus.
Key What it does
Tab Moves focus to the field. The panel stays closed, so you can tab straight past it.
Arrow Down Opens the panel and moves focus into it.
Enter or Space On the icon button beside the field: opens the panel and moves focus into it, or closes it.
Enter Commits a value typed into the field.
Escape Closes the panel and returns focus to the field. Works from the field and from inside the panel.
Tab or Shift+ plus Tab Moves between the controls in the open panel. Focus stays in the panel until it is closed.
Arrow Up or Arrow Down In the hour or minute field: increases or decreases the value by one, or moves to the next or previous step when Step is set. When Step is a whole number of hours, the minutes are fixed text and are skipped by Tab.
Enter or Space On an arrow button or the AM/PM button: presses it.

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.

On this page

  • Basic time picker
  • Input variants
  • 12hr time picker
  • Step
  • Dense time picker
  • Disabled and readonly time picker
  • Keyboard navigation
  • Theme configuration
twblazor

The Tailwind CSS component library for Blazor. Accessible, themeable and MIT licensed.

Discord (opens in a new tab) GitHub(opens in a new tab)

Get started

  • Install guide
  • Theming
  • Class merging
  • Localization

Guides

  • Tailwind CSS with Blazor
  • Why twblazor?
  • Right to left
  • AI agents and skills

Resources

  • API documentation (opens in a new tab)
  • llms.txt (opens in a new tab)
  • MIT License (opens in a new tab)

Community

  • Contributing (opens in a new tab)
  • Code of conduct (opens in a new tab)
  • Report an issue (opens in a new tab)

twblazor is and always will be free and open source.

An unhandled error has occurred. Reload