Browse documentation

Date, time, and color

Choose dates, ranges, times, and colors using keyboard-friendly controls.

Import

Load the optional component layer before using the examples below.

Ruby
require "zaniah/ui"

Date and time pickers

Dates use ISO 8601 strings or Ruby Date values; times use 24-hour notation.

Rendered example
Date, time, and color picker controls under selection fields.
Rendered by Zaniah's headless backend.
Ruby
Zaniah::UI::DatePicker.new("2026-09-25", label: "Due date")
Zaniah::UI::TimePicker.new("14:30", label: "Start")
Zaniah::UI::ColorPicker.new("#2563eb", label: "Accent")

Calendar and range

Calendar supports week_start: 0..6. DateRangePicker returns a two-element value; the end can be nil until selected.

Rendered example
Calendar and date range selection rendered in Zaniah.
Rendered by Zaniah's headless backend.
Ruby
Zaniah::UI::Calendar.new(value: "2026-09-25", week_start: 1)
Zaniah::UI::DateRangePicker.new(
  value: ["2026-09-01", "2026-09-30"])

API summary

Constructor options and behaviors are drawn from the component reference.

ComponentConstructor and methodsVariants or behavior
DatePicker(value, min:, max:, label:, disabled:); on_changeISO date, day/week keyboard steps
Calendar(value:, min:, max:, range:, week_start:, month_names:); on_changearrow keys move days/weeks, Page keys move months, Enter selects
DateRangePicker(value:, min:, max:, week_start:, month_names:); on_changeCalendar-backed start/end selection
TimePicker(value, step:, label:, disabled:); on_change24-hour time, minute/hour keyboard steps
ColorPicker(value, label:, swatches:, disabled:); on_changehex input and swatches

Accessibility

Calendar is a grid. Arrow keys move by day or week; Page keys move by month; Enter selects a day.

ComponentSemantic role
DatePickercombobox
Calendargrid/gridcell
DateRangePickercombobox
TimePickercombobox
ColorPickercombobox