Skip to main content

Calendar

Calendar is a presentational month picker exported from @ovok/native/ui. It supports controlled or internal selection, month navigation, localized labels, week-start configuration, disabled dates, and optional day markers. It does not persist values or perform platform or network work.

import { Calendar } from "@ovok/native/ui";

<Calendar
selectedDate={selectedDate}
onDateSelect={setSelectedDate}
locale="en-GB"
weekStartsOn={1}
minDate="2026-01-01"
/>

Pass selectedDate to control selection; update it in onDateSelect. Without selectedDate, the component keeps its own selection, initialized by defaultSelectedDate. Month navigation is controlled by visibleMonth and onVisibleMonthChange, or internally initialized by defaultVisibleMonth. Selection callbacks return local calendar Date values. Date-only strings in YYYY-MM-DD form are parsed as local calendar dates to avoid UTC day shifts.

PropTypeDefaultDescription
selectedDateDate | string | nullinternalControlled selected day; null clears it
defaultSelectedDateDate | string—Initial selection for uncontrolled mode
onDateSelect(date: Date) => void—Called when an enabled day is selected
visibleMonthDate | stringinternalControlled month to display
defaultVisibleMonthDate | stringselected day or todayInitial month for uncontrolled mode
onVisibleMonthChange(month: Date) => void—Called with the first day of the displayed month
localestringdevice localeLocale for month, weekday, and accessible date labels
weekStartsOn0 | 1 | 2 | 3 | 4 | 5 | 61First weekday, where 0 is Sunday
minDate, maxDateDate | string—Inclusive selectable date bounds
isDateDisabled(date: Date) => boolean—Additional caller-defined disabled dates
markersreadonly CalendarDayMarker[][]Static marked days
getMarkerForDate(date: Date) => CalendarDayMarker | undefined—Dynamic day marker, useful for composed calendars
labelForDate(date: Date) => stringlocalized dateOverride the accessible date label
previousMonthLabel, nextMonthLabelstring“Previous month”, “Next month”Accessible navigation button labels
theme, slotsOvokThemeOverride, Partial<OvokUiSlots>Paper theme/default slotOptional UI theme and primitive overrides
testIDstringcalendarPrefix for calendar and day test IDs

CalendarDayMarker accepts date, optional label, backgroundColor, color, and optional rangePosition (single, start, middle, or end) to draw a continuous marked band. Every date and navigation control exposes an accessible label; selected and disabled states are also exposed to assistive technology.