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

TwDatePicker

TwDatePicker is a Blazor date picker component with a calendar popup. Bind Value, set MinDate, MaxDate, Format and Placeholder, or use the native input.

Last updated 16 October 2026

Basic date picker

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

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

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

RAZOR
<div class="space-y-4">
    <p><b>@@bind-SelectedDate (DateTime):</b> @SelectedDate.ToShortDateString()</p>
    <TwDatePicker Id="basic-datepicker" @bind-SelectedDate="SelectedDate" Label="Select a datetime" Class="mt-3" />
    <p><b>@@bind-Value (string):</b> @SelectedDateTextValue</p>
    <TwDatePicker Id="basic-datepicker-string" @bind-Value="SelectedDateTextValue" Label="Select a datetime" Class="mt-3" />
</div>
CSHARP
@code {
    public DateTime SelectedDate { get; set; } = DateTime.Now;
    public string SelectedDateTextValue { get; set; } = DateTime.Now.ToShortDateString();
}

Custom format

Format accepts any .NET custom date format string and is used for both display and for parsing what's typed - the placeholder updates to match automatically. Use it for US-style month-first dates, dash-separated dates, or any other pattern your locale needs.
RAZOR
<div class="space-y-4">
    <TwDatePicker Id="us-format-datepicker" @bind-SelectedDate="SelectedDate" Format="MM/dd/yyyy" Label="US format (MM/dd/yyyy)" Class="mt-3" />
    <TwDatePicker Id="dash-format-datepicker" @bind-SelectedDate="SelectedDate" Format="dd-MM-yyyy" Label="Dash format (dd-MM-yyyy)" Class="mt-3" />
</div>
CSHARP
@code {
    public DateTime SelectedDate { get; set; } = DateTime.Now;
    public string SelectedDateTextValue { get; set; } = DateTime.Now.ToShortDateString();
}

Input variants

The DatePicker supports different visual variants for the input field.
RAZOR
<div class="space-y-4">
    <TwDatePicker Id="default-variant" @bind-SelectedDate="SelectedDate" Label="Default Variant" Variant="InputVariant.Default" />
    <TwDatePicker Id="outlined-variant" @bind-SelectedDate="SelectedDate" Label="Outlined Variant" Variant="InputVariant.Outlined" />
    <TwDatePicker Id="filled-variant" @bind-SelectedDate="SelectedDate" Label="Filled Variant" Variant="InputVariant.Filled" />
</div>
CSHARP
@code {
    public DateTime SelectedDate { get; set; } = DateTime.Now;
    public string SelectedDateTextValue { get; set; } = DateTime.Now.ToShortDateString();
}

Dense date 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
<TwDatePicker Id="dense-datepicker" @bind-SelectedDate="SelectedDate" Label="Dense Date Picker" Dense />
CSHARP
@code {
    public DateTime SelectedDate { get; set; } = DateTime.Now;
    public string SelectedDateTextValue { get; set; } = DateTime.Now.ToShortDateString();
}

Disabled and readonly date picker

Use the Disabled and ReadOnly properties to restrict interaction with the date picker.
RAZOR
<div class="space-y-4">
    <TwDatePicker Id="disabled-datepicker" @bind-SelectedDate="SelectedDate" Label="Disabled Date Picker" Disabled />
    <TwDatePicker Id="readonly-datepicker" @bind-SelectedDate="SelectedDate" Label="Readonly Date Picker" ReadOnly />
</div>
CSHARP
@code {
    public DateTime SelectedDate { get; set; } = DateTime.Now;
    public string SelectedDateTextValue { get; set; } = DateTime.Now.ToShortDateString();
}

Keyboard navigation

Type a date straight into the field, or open the calendar. The calendar 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 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.

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 date picker
  • Custom format
  • Input variants
  • Dense date picker
  • Disabled and readonly date 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