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

TwDateRangePicker

TwDateRangePicker is a Blazor date range picker with a two-month calendar popup. Bind Value or SelectedRange and constrain it with MinDate and MaxDate.

Last updated 16 October 2026

Basic date range picker

Bind SelectedRange for a KeyValuePair<DateTime?, DateTime?> value (Key = start, Value = end). Select a start date, then an end date - the range highlights across both calendar months and survives month navigation. Shares its theme (TwDatePickerTheme) with TwDatePicker.

@bind-SelectedRange: - - -

RAZOR
<div class="space-y-4">
    <p><b>@@bind-SelectedRange:</b> @(SelectedRange.Key?.ToShortDateString() ?? "-") - @(SelectedRange.Value?.ToShortDateString() ?? "-")</p>
    <TwDateRangePicker Id="basic-daterangepicker" @bind-SelectedRange="SelectedRange" Label="Select a date range" Class="mt-3" />
</div>
CSHARP
@code {
    public KeyValuePair<DateTime?, DateTime?> SelectedRange { get; set; }
}

Custom format

Format is a plain .NET custom date format string applied identically to both the start and end date - the same parameter TwDatePicker uses. The separator between the two dates defaults to " - " and is configurable via RangeSeparator.
RAZOR
<div class="space-y-4">
    <TwDateRangePicker Id="us-format-daterangepicker" @bind-SelectedRange="SelectedRange" Format="MM/dd/yyyy" Label="US format (MM/dd/yyyy)" Class="mt-3" />
</div>
CSHARP
@code {
    public KeyValuePair<DateTime?, DateTime?> SelectedRange { get; set; }
}

Min and max date

Use the MinDate and MaxDate properties to restrict the selectable range. Out-of-bounds days render disabled and the month navigation arrows stop at the boundary.
RAZOR
<TwDateRangePicker Id="bounded-daterangepicker" @bind-SelectedRange="BoundedRange" MinDate="MinDate" MaxDate="MaxDate" Label="Select within the next 30 days" Class="mt-3" />
CSHARP
@code {
    public KeyValuePair<DateTime?, DateTime?> BoundedRange { get; set; }
    public DateTime MinDate { get; set; } = DateTime.Today;
    public DateTime MaxDate { get; set; } = DateTime.Today.AddDays(30);
}

Input variants

The date range picker supports the same visual variants as the other text inputs.
RAZOR
<div class="space-y-4">
    <TwDateRangePicker Id="default-variant" @bind-SelectedRange="SelectedRange" Label="Default Variant" Variant="InputVariant.Default" />
    <TwDateRangePicker Id="outlined-variant" @bind-SelectedRange="SelectedRange" Label="Outlined Variant" Variant="InputVariant.Outlined" />
    <TwDateRangePicker Id="filled-variant" @bind-SelectedRange="SelectedRange" Label="Filled Variant" Variant="InputVariant.Filled" />
</div>
CSHARP
@code {
    public KeyValuePair<DateTime?, DateTime?> SelectedRange { get; set; }
}

Dense date range 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
<TwDateRangePicker Id="dense-daterangepicker" @bind-SelectedRange="SelectedRange" Label="Dense Date Range Picker" Dense />
CSHARP
@code {
    public KeyValuePair<DateTime?, DateTime?> SelectedRange { get; set; }
}

Disabled and readonly date range picker

Use the Disabled and ReadOnly properties to restrict interaction with the date range picker.
RAZOR
<div class="space-y-4">
    <TwDateRangePicker Id="disabled-daterangepicker" @bind-SelectedRange="SelectedRange" Label="Disabled Date Range Picker" Disabled />
    <TwDateRangePicker Id="readonly-daterangepicker" @bind-SelectedRange="SelectedRange" Label="Readonly Date Range Picker" ReadOnly />
</div>
CSHARP
@code {
    public KeyValuePair<DateTime?, DateTime?> SelectedRange { get; set; }
}

Keyboard navigation

Type a range into the field, or open the calendar, which shows two months side by side. Pick the start day, then the end day.
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 range picker
  • Custom format
  • Min and max date
  • Input variants
  • Dense date range picker
  • Disabled and readonly date range 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