Calendar
A calendar component that allows users to select a date or a range of dates.
Installation
Usage
<Calendar Mode="CalendarMode.Single" @bind-Selected="_date" Class="rounded-lg border" />
@code {
private DateOnly? _date = DateOnly.FromDateTime(DateTime.Today);
}The component is a Razor port of React DayPicker. Its documentation covers the markup, styling hooks, and keyboard behavior reproduced here.
About
The Calendar component reproduces the markup, class names, and keyboard navigation of React DayPicker, without a JavaScript dependency.
Date Picker
You can use the <Calendar> component to build a date picker. See the Date Picker page for more information.
Persian / Hijri / Jalali Calendar
Not supported. The calendar uses the Gregorian calendar.
Selected Date (With TimeZone)
The Calendar component accepts a TimeZone parameter (a system time zone id) to decide which day is today. Selected values are DateOnly, so they never shift with the time zone.
<Calendar Mode="CalendarMode.Single" @bind-Selected="_date" TimeZone="America/New_York" />
@code {
private DateOnly? _date;
}Basic
A basic calendar component. We used Class="rounded-lg border" to style the calendar.
Range Calendar
Use Mode="CalendarMode.Range" to enable range selection.
Month and Year Selector
Use CaptionLayout="CalendarCaptionLayout.Dropdown" to show month and year dropdowns.
Presets
Date and Time Picker
Booked dates
Custom Cell Size
You can customize the size of calendar cells using the --cell-size CSS variable. You can also make it responsive by using breakpoint-specific values:
<Calendar Mode="CalendarMode.Single" @bind-Selected="_date"
Class="rounded-lg border [--cell-size:--spacing(11)] md:[--cell-size:--spacing(12)]" />Or use fixed values:
<Calendar Mode="CalendarMode.Single" @bind-Selected="_date"
Class="rounded-lg border [--cell-size:2.75rem] md:[--cell-size:3rem]" />Week Numbers
Use ShowWeekNumber to show week numbers.
RTL
To enable RTL support in Blazix, see the RTL configuration guide.
Translated with AI for the demo, so it may have mistakes.
API Reference
Calendar
Other attributes are passed to the element it renders.
CalendarDayButton
Other attributes are passed to the element it renders.