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

TwDateTimePicker

TwDateTimePicker is a Blazor component for choosing a date and time in one input. Bind Value, set Format and Placeholder, and use PreferNativePicker on mobile.

Last updated 16 October 2026

Basic DateTime picker

Bind SelectedDateTime for a DateTime value, or Value for a plain string.

@bind-SelectedDate (DateTime): 11/28/2026

@bind-Value (string): 28/11/2026 22:14

RAZOR
<div class="space-y-4">
    <p><b>@@bind-SelectedDate (DateTime):</b> @SelectedDateTime.ToShortDateString()</p>
    <TwDateTimePicker @bind-SelectedDateTime="SelectedDateTime" Label="Select a datetime" Class="mt-3" />
    <p><b>@@bind-Value (string):</b> @SelectedDateTimeTextValue</p>
    <TwDateTimePicker @bind-Value="SelectedDateTimeTextValue" Label="Select a datetime" Class="mt-3" />
</div>
CSHARP
@code {
    public DateTime SelectedDateTime { get; set; } = DateTime.Now;
    public string SelectedDateTimeTextValue { get; set; } = DateTime.Now.ToString("dd/MM/yyyy HH:mm");
}

Input variants

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

Step

Set Step to the number of minutes the time 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
<TwDateTimePicker Id="step-datetimepicker" @bind-SelectedDateTime="SelectedDateTime" Label="Every 30 minutes" Step="30" />
CSHARP
@code {
    public DateTime SelectedDateTime { get; set; } = DateTime.Now;
    public string SelectedDateTimeTextValue { get; set; } = DateTime.Now.ToString("dd/MM/yyyy HH:mm");
}

Dense DateTime 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
<TwDateTimePicker @bind-SelectedDateTime="SelectedDateTime" @bind-Value="SelectedDateTimeTextValue" Label="Dense DateTime Picker" Dense />
CSHARP
@code {
    public DateTime SelectedDateTime { get; set; } = DateTime.Now;
    public string SelectedDateTimeTextValue { get; set; } = DateTime.Now.ToString("dd/MM/yyyy HH:mm");
}

Disabled and readonly DateTime picker

Use the Disabled and ReadOnly properties to restrict interaction with the datetime picker.
RAZOR
<div class="space-y-4">
    <TwDateTimePicker @bind-SelectedDateTime="SelectedDateTime" @bind-Value="SelectedDateTimeTextValue" Label="Disabled DateTime Picker" Disabled />
    <TwDateTimePicker @bind-SelectedDateTime="SelectedDateTime" @bind-Value="SelectedDateTimeTextValue" Label="Readonly DateTime Picker" ReadOnly />
</div>
CSHARP
@code {
    public DateTime SelectedDateTime { get; set; } = DateTime.Now;
    public string SelectedDateTimeTextValue { get; set; } = DateTime.Now.ToString("dd/MM/yyyy HH:mm");
}

Keyboard navigation

Type a date and time into the field, or open the panel, which holds a calendar above an hour and minute picker.
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 Left or Arrow Right Moves to the previous or next day. Moving past the start or end of the month turns the page. The two keys swap in a right to left layout.
Arrow Up or Arrow Down Moves to the same weekday in the previous or next week.
Home or End Moves to the first or last day of the week.
Pg.Up or Pg.Down Moves to the previous or next month.
Shift+ plus Page Up or Shift+ plus Page Down Moves to the previous or next year.
Enter or Space Selects the focused day.
Enter or Space On the month and year heading: switches to the list of months, then of years. Focus lands on the current one, and Tab moves between them.
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 TwDatePickerTheme), 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
Header string
WeekdaysHeader string
Base string
ActiveClass string
SelectedClass string
HoverClass string
StageTabActive string
ButtonClass string
RangeClass string
RangeMonthCaptionClass string
PrevMonthClass string
DefaultFormat string
DefaultDateTimeFormat string
DefaultDateTimeFormat12Hour string
DefaultRangeSeparator string
IconTriggerWrapper string
IconGlyph string
TextfieldPadding string
NativeInputAppearance string
PanelWidth string
HeaderControls string
Body string
YearsGrid string
MonthsGrid string
DualMonthLayout string
DualMonthColumn string
DayGrid string
DayHeaderCellPadding string
DayAbbreviation string
RangeStageTabsContainer string
RangeStageTabInactive string
PanelMaxHeight string
PanelMaxWidth string
DualMonthPanelWidth string
StageTabBase string
HeaderNavButton string

Full reference: TwDatePickerTheme on the API docs.

On this page

  • Basic DateTime picker
  • Input variants
  • Step
  • Dense DateTime picker
  • Disabled and readonly DateTime 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