Skip to content
GitHub11 stars

A date picker component with range and presets.

@using System.Globalization
<Popover>
    <PopoverTrigger>

Installation

The Date Picker is built using a composition of the <Popover /> and the <Calendar /> components.

See installation instructions for the Popover and the Calendar components.

Usage

<Popover>
    <PopoverTrigger>
        <Render>
            <Button @attributes="context.Attributes" Variant="ButtonVariant.Outline" data-empty="@(_date is null ? "true" : "false")"
                    Class="justify-start text-left font-normal data-[empty=true]:text-muted-foreground">
                <Icon Data="LucideIcons.Calendar" />
                @if (_date is { } date)
                {
                    @date.ToString("MMMM d, yyyy")
                }
                else
                {
                    <span>Pick a date</span>
                }
            </Button>
        </Render>
    </PopoverTrigger>
    <PopoverContent Class="w-auto p-0">
        <Calendar Mode="CalendarMode.Single" @bind-Selected="_date" />
    </PopoverContent>
</Popover>

@code {
    private DateOnly? _date;
}

Composition

A date picker is built from Popover and Calendar (there is no DatePicker root component):

Popover
+-- PopoverTrigger
+-- PopoverContent
    +-- Calendar

Basic

A basic date picker component.

@using System.Globalization
<Field Class="mx-auto w-44">
    <FieldLabel for="date-picker-simple">Date</FieldLabel>

Range Picker

A date picker component for selecting a range of dates.

@using System.Globalization
<Field Class="mx-auto w-60">
    <FieldLabel for="date-picker-range">Date Picker Range</FieldLabel>

Date of Birth

A date picker component for selecting a date of birth. This component includes a dropdown caption layout for date and month selection.

@using System.Globalization
<Field Class="mx-auto w-44">
    <FieldLabel for="date">Date of birth</FieldLabel>

Input

A date picker component with an input field for selecting a date.

@using System.Globalization
<Field Class="mx-auto w-48">
    <FieldLabel for="date-required">Subscription Date</FieldLabel>

Time Picker

A date picker component with a time input field for selecting a time.

@using System.Globalization
<FieldGroup Class="mx-auto max-w-xs flex-row">
    <Field>

Natural Language Picker

This example parses a few natural language phrases such as "tomorrow", "in 2 weeks", or "next friday".

Your post will be published on December 07, 2026.
@using System.Globalization
@using System.Text.RegularExpressions
<Field Class="mx-auto max-w-xs">

RTL

To enable RTL support in Blazix, see the RTL configuration guide.

Translated with AI for the demo, so it may have mistakes.

<Popover>
    <PopoverTrigger>
        <Render>