class RatatuiRuby::Calendar
Displays a monthly calendar grid.
Dates are complex. Rendering them in a grid requires calculation of leap years, month lengths, and day-of-week offsets. Use this widget to skip the boilerplate.
This widget renders a standard monthly view. It highlights the current date. It structures time.
Use it for date pickers, schedulers, or logs.
Examples
Calendar.new( year: 2025, month: 12, default_style: Style.new(fg: :white), header_style: Style.new(fg: :yellow, modifiers: [:bold]) )
Attributes
Optional wrapping block.
Style for the days.
A Hash mapping Dates to Styles for event highlighting. Keys must be βDate` objects (or objects responding to `day`, `month`, `year`). Values must be `Style` objects.
Style for the month name header.
The month to display (1β12).
Style for dates from surrounding months. If nil, surrounding dates are hidden.
Whether to show the weekday header (Mon, Tue, etc.).
The year to display (Integer).
Public Class Methods
Source
# File lib/ratatui_ruby/schema/calendar.rb, line 69 def initialize(year:, month:, events: {}, default_style: nil, header_style: nil, block: nil, show_weekdays_header: true, show_surrounding: nil, show_month_header: false) super( year: Integer(year), month: Integer(month), events: events, default_style: default_style, header_style: header_style, block: block, show_weekdays_header: show_weekdays_header, show_surrounding: show_surrounding, show_month_header: show_month_header ) end
Creates a new Calendar.
- year
-
Integer.
- month
-
Integer.
- events
-
Hash<Date, Style>. Optional.
default_styleheader_style- block
show_weekdays_header-
Boolean. Whether to show the weekday header.
show_surrounding