Skip to content

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.

Calendar screenshot

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'));

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 TDateTime

Configuration

MethodPurpose
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)));

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);

API reference

See also

Released under the MIT License.