Calendar
ICalendar renders a month grid with the supplied date highlighted. Day-of-week headers are localised; first-day-of-week and language come from the host culture or an explicit override.
![]()
When to use
- Date pickers in CLIs.
- Schedule overviews, "today" banners.
- Anywhere you need to show a month and call out a specific day.
Basic usage
pascal
AnsiConsole.Write(
Widgets.Calendar(2026, 4, 25)
.WithCulture('en-GB'));1
2
3
2
3
Three constructor overloads:
pascal
Widgets.Calendar(2026, 4) // April 2026, day 1 highlighted
Widgets.Calendar(2026, 4, 25) // April 2026, day 25 highlighted
Widgets.Calendar(EncodeDate(2026, 4, 25)) // from a TDateTime1
2
3
2
3
Configuration
| Method | Purpose |
|---|---|
WithCulture(name) | Locale for day/month names — 'en-US', 'en-GB', 'fr-FR', 'de-DE', etc. |
WithBorder(kind) | One of the TTableBorderKinds. Default Square. |
WithHeaderStyle(value) | Style for day-of-week headers. |
WithHighlightStyle(value) | Style for the highlighted date cell. |
WithBorderStyle(value) | Style for the border characters. |
pascal
AnsiConsole.Write(
Widgets.Calendar(2026, 4, 25)
.WithCulture('fr-FR')
.WithBorder(TTableBorderKind.Rounded)
.WithHeaderStyle(TAnsiStyle.Plain.WithForeground(TAnsiColor.Aqua))
.WithHighlightStyle(TAnsiStyle.Plain.WithBackground(TAnsiColor.Yellow)));1
2
3
4
5
6
2
3
4
5
6
Adding events (markers)
You can add per-day markers shown alongside the calendar:
pascal
cal := Widgets.Calendar(2026, 4, 25);
cal.AddCalendarEvent('Sprint review', 2026, 4, 14);
cal.AddCalendarEvent('Release', 2026, 4, 25);
AnsiConsole.Write(cal);1
2
3
4
2
3
4
API reference
Widgets.Calendar(year, month)Widgets.Calendar(year, month, day)Widgets.Calendar(date)ICalendar— interface.- Demo:
demos/snippets/Calendar.