Calendar
A month grid following the WAI-ARIA date picker pattern: arrow keys, Page Up/Down, Home and End, in single, multiple or range mode.
Examples
Single date
Dates outside the minimum and maximum, and the listed ones, are disabled.
Selected: 2026-11-19
<div class="flex flex-col items-center gap-3">
<KlyCalendar @bind-Value="_date" Min="_min" Max="_max" DisabledDates="_disabled" AriaLabel="Appointment date" data-testid="calendar" />
<p class="text-sm text-(--klyroo-text-muted)" data-testid="calendar-state">Selected: @(_date?.ToString("yyyy-MM-dd") ?? "none")</p>
</div>
@code {
private DateOnly? _date = new(2026, 11, 19);
private readonly DateOnly _min = new(2026, 11, 3);
private readonly DateOnly _max = new(2026, 12, 20);
private readonly DateOnly[] _disabled = [new(2026, 11, 25)];
}In an EditForm
Multiple posts one entry per date; a range posts name.Start and name.End.
@using System.ComponentModel.DataAnnotations
<EditForm Model="Model" FormName="calendar-form" OnValidSubmit="Save" class="flex flex-col items-start gap-4" novalidate>
<div class="flex flex-wrap items-start gap-8">
<KlyCalendar Mode="KlyCalendarMode.Multiple" @bind-Values="Model!.Days" AriaLabel="Days to book" data-testid="form-days" />
<KlyCalendar Mode="KlyCalendarMode.Range" @bind-Range="Model!.Stay" AriaLabel="Stay dates" data-testid="form-stay" />
</div>
<KlyButton Type="ButtonType.Submit" Label="Book dates" />
@if (_saved)
{
<p role="status" class="text-sm text-(--klyroo-success-text)" data-testid="calendar-saved">Booked: @Text()</p>
}
</EditForm>
@code {
[SupplyParameterFromForm(FormName = "calendar-form")]
private Booking? Model { get; set; }
private bool _saved;
protected override void OnInitialized() => Model ??= new();
private void Save() => _saved = true;
private string Text() =>
$"{string.Join(",", Model!.Days.Select(d => d.ToString("MM-dd")))} / {Model.Stay?.Start:yyyy-MM-dd} to {Model.Stay?.End:yyyy-MM-dd}";
private sealed class Booking
{
public IReadOnlyList<DateOnly> Days { get; set; } = [new(2026, 11, 2)];
public KlyDateRange? Stay { get; set; } = new(new DateOnly(2026, 11, 9), new DateOnly(2026, 11, 13));
}
}Not bound
Without a binding the browser keeps the selection, even when other parameters change.
<div class="flex flex-col items-center gap-3">
<KlyCalendar Value="@(new DateOnly(2026, 11, 10))" Min="_min" Name="visit" AriaLabel="Visit date" data-testid="unbound-calendar" />
<KlyButton Variant="ButtonVariant.Outline" Label="Move the minimum" OnClick="Move" />
</div>
@code {
private DateOnly _min = new(2026, 11, 1);
private void Move() => _min = _min.AddDays(1);
}Range and multiple
Month and day names and the first day of the week come from the culture.
Range: 2026-11-09 to 2026-11-13
Days: 11-02, 11-20
<div class="flex flex-wrap items-start justify-center gap-8">
<div class="flex flex-col items-center gap-2">
<KlyCalendar Mode="KlyCalendarMode.Range" @bind-Range="_range" WeekStart="DayOfWeek.Monday" AriaLabel="Stay" data-testid="range" />
<p class="text-sm text-(--klyroo-text-muted)" data-testid="range-state">Range: @Text(_range)</p>
</div>
<div class="flex flex-col items-center gap-2">
<KlyCalendar Mode="KlyCalendarMode.Multiple" @bind-Values="_dates" AriaLabel="Days off" data-testid="multiple" />
<p class="text-sm text-(--klyroo-text-muted)" data-testid="multiple-state">Days: @(_dates.Count == 0 ? "none" : string.Join(", ", _dates.Select(d => d.ToString("MM-dd"))))</p>
</div>
</div>
@code {
private KlyDateRange? _range = new(new DateOnly(2026, 11, 9), new DateOnly(2026, 11, 13));
private IReadOnlyList<DateOnly> _dates = [new DateOnly(2026, 11, 2), new DateOnly(2026, 11, 20)];
private static string Text(KlyDateRange? range) =>
range?.Start is null ? "none" : $"{range.Start:yyyy-MM-dd} to {(range.End is { } end ? end.ToString("yyyy-MM-dd") : "...")}";
}API
KlyCalendar
Month calendar to pick a single date, several dates or a range, with keyboard navigation and localized month and day names.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
AriaLabel |
string |
Accessible name of the calendar. | |
Class |
string |
Classes added to the root element, merged last so they win over the theme. | |
Color |
KlyColor |
"primary" |
Semantic color of the control: a built-in KlyColor or the name of a color you defined. When not set, Color applies, else primary. Values: primary, secondary, success, info, warning, error, neutral. |
Culture |
CultureInfo |
Source of month and day names and of the first day of the week. Defaults to the format culture of the locale in effect (the regional current culture when it has the same language). | |
Disabled |
bool |
false |
Disables the control: it cannot be focused or changed and is not submitted. |
DisabledDates |
IEnumerable |
Dates that cannot be selected, besides those outside Min and Max . | |
Id |
string |
The id of the native control. Defaults to the one of the enclosing KlyFormField , else a generated one. | |
Max |
DateOnly? |
Latest selectable date. | |
Min |
DateOnly? |
Earliest selectable date. | |
Mode |
KlyCalendarMode |
KlyCalendarMode. |
What the calendar selects. Single binds Value , Multiple binds Values , Range binds Range . Values: Single, Multiple, Range. |
Name |
string |
Form field name outside an EditForm . Inside one, the name comes from the bound expression. | |
Range (@bind-Range) |
KlyDateRange |
The selected range in Range mode. | |
RangeExpression |
Expression |
Lets an EditForm name the posted entries and validate Range . Set by @bind-Range . The range posts as name.Start and name.End . | |
Required |
bool |
false |
Marks the control as required, for the browser and for assistive technology. |
Size |
KlySize? |
Defaults to the size of the enclosing KlyFormField , or medium. Values: Xs, Sm, Md, Lg, Xl. |
|
Ui |
CalendarUi |
Per-instance class overrides of the slots of the calendar, see CalendarUi . They are merged after the theme and the Class parameter wins on the root slot. | |
Value (@bind-Value) |
DateOnly? |
The value of the control. Bind it with @bind-Value . | |
ValueExpression |
Expression |
The expression of the bound field. The compiler sets it with @bind-Value , and validation uses it to find the field. | |
Values (@bind-Values) |
IReadOnlyList |
The selected dates in Multiple mode. | |
ValuesExpression |
Expression |
Lets an EditForm name the posted entries and validate Values . Set by @bind-Values . Each date posts as its own entry. | |
WeekStart |
DayOfWeek? |
First column of the grid. Defaults to the culture's first day of the week. Values: Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday. |
Ui slots
Ui takes a CalendarUi with one class string per slot, merged after the theme.
| Slot | Styles |
|---|---|
Root |
Classes merged into the root slot of KlyCalendar , after the theme and the app configuration. |
Header |
Classes merged into the header slot of KlyCalendar , after the theme and the app configuration. |
Heading |
Classes merged into the heading slot of KlyCalendar , after the theme and the app configuration. |
Nav |
Classes merged into the nav slot of KlyCalendar , after the theme and the app configuration. |
Grid |
Classes merged into the grid slot of KlyCalendar , after the theme and the app configuration. |
Weekday |
Classes merged into the weekday slot of KlyCalendar , after the theme and the app configuration. |
Cell |
Classes merged into the cell slot of KlyCalendar , after the theme and the app configuration. |
Day |
Classes merged into the day slot of KlyCalendar , after the theme and the app configuration. |
KlyDateRange
A range of dates. End is null while only the start has been chosen.
Parameters
| Name | Type | Description |
|---|---|---|
End |
DateOnly? |
Last date of the range, or null while only the start has been chosen. |
Start |
DateOnly? |
First date of the range, or null when none was chosen. |