Calix

API Reference

Components, hooks, values, and core contracts.

All date-picking components require an adapter. Their public values use native JavaScript Date objects; calendar-specific parts are only exposed to adapter and headless-hook APIs.

Shared calendar options

Calendar, DatePicker, useCalendar, and useDatePicker accept these options.

PropTypeDefault
adapterCalendarAdapterrequired
mode"single" | "multiple" | "range" | "week" | "month" | "quarter" | "year""single"
value / defaultValueCalixValuemode empty value
onChange(value: CalixValue) => void
onSelect(value: CalixValue, complete: boolean) => void
localestringadapter default
dir"ltr" | "rtl"adapter locale result
labelsPickerLabelslocalized defaults
theme"dark" | "light""dark"
weekStartsOn06Saturday for fa-*, Sunday otherwise
defaultMonthDateselected date or today
numberOfMonthsnumber1
fixedWeeksbooleantrue
maxnumber—; multiple mode only
minRange / maxRangenumber—; inclusive days, range mode only
weekendDaysWeekday[][5] for fa-*, [0, 6] otherwise
onMonthChange(view: MonthView) => void—; excludes initial render
onFocusChange(date: CalendarDate) => void—; excludes initial render
onOutputChange(value: string) => void
outputFormat"string" | "json""string"
outputPatternstring"yyyy-MM-dd"

complete is false only while a range is waiting for its end date.

Constraints

PropTypeMeaning
minDate / maxDateDateInclusive allowed boundaries.
disabledDatesDate[]Explicitly blocked dates.
enabledDatesDate[]When present, only these dates are allowed.
disabledWeekdaysWeekday[]0 Sunday through 6 Saturday.
disabledMonths / disabledYearsnumber[]Calendar month numbers (1-based) or years to block.
businessDaysOnlybooleanBlocks the configured weekendDays.
weekendDaysWeekday[]Weekend days; [5] for fa-*, [0, 6] otherwise.
holidaysDate[]Dates treated as blocked.
holidayDatareadonly Holiday[]Named dates for holiday markers and tooltips.
showHolidaysbooleanShows holiday markers and names; default false.
holidaysSelectablebooleanKeeps holidayData dates selectable; default true.
isDateDisabled(date, adapter) => booleanReturn true to block a calendar date.

<DatePicker>

The convenience popover picker. In addition to shared options:

PropTypeDefault
placeholderstring"Select date"
patternstring"yyyy/MM/dd" or date-time equivalent
classNamesDatePickerClassNames
withTimebooleanfalse
timePickerPropsTimeFieldProps without value handlers
showToday / showClear / showCancelbooleantrue / false / true
infiniteScrollbooleanfalse
presetsCalendarPreset[]
open / defaultOpenbooleanuncontrolled / false
onOpenChange(open: boolean) => void
closeOnSelectbooleantrue
placementPopover placement"bottom-start"
offsetnumber8

Compound components

DatePicker.Root takes the shared options plus open-state options. DatePicker.Trigger is a button wired to the popover. DatePicker.Input accepts all native input props plus pattern, mask, and reference. DatePicker.Content accepts classNames, className (the popover surface), showToday, showCancel, portal (default true), and custom children.

<Calendar> and <CalendarView>

Calendar is an inline component that takes shared options plus:

PropType
classNamesCalendarClassNames
renderDay(date: CalendarDate, defaultLabel: string) => ReactNode
header / footerReactNode | (calendar) => ReactNode
showToday / showClear / infiniteScrollboolean

CalendarView is presentational. It receives a calendar result returned by useCalendar, then accepts the same rendering props above.

CalendarClassNames has slots: root, header, heading, nav, navButton, months, grid, weekdays, weekday, week, day, footer, footerButton, presets, preset, picker, pickerBody, month, and year. DatePickerClassNames includes every CalendarClassNames slot plus popover, field, input, toggle, clear, dateTime, timeStep, timeBack, timeTitle, and timeActions.

<TimeField>, <MonthPicker>, and <YearPicker>

TimeField takes value, defaultValue, onChange, hourCycle (12 or 24), minuteStep, secondStep, withSeconds, variant ("field", "wheel", or "analog"), labels, theme, className, and disabled.

MonthPicker forces month selection; YearPicker forces year selection. Both take shared calendar options. YearPicker also has pageSize (default 12).

Hooks

HookReturns
useCalendar(options)Calendar state, navigation, selection methods, checks, grids, and prop getters.
useDatePicker(options)useCalendar plus popover state, refs/styles, and interaction getters.
useDateInput(options)inputValue, setInputValue, and getInputProps.
useTime(options?)Time value, display state, setters, and increment helpers.
useControllableState(options)Controlled/uncontrolled state primitive.

Values and types

CalixValue is Date | Date[] | RangeValue | null; RangeValue is { start: Date | null; end: Date | null }. Weekday is 0 through 6.

PickerLabels can override weekdays, navigation, month/year choices, time labels, and today/now/confirm/clear/cancel actions. See Localization.

CalendarAdapter

Every calendar adapter implements: today; toDate / fromDate; day, month, and year arithmetic; month boundaries; month length and leap-year rules; weekday, month-grid, year-range, and week-number methods; comparison/equality; parsing, formatting, localized names, and RTL detection.

Import it from @alydev/core:

import type { CalendarAdapter, CalendarDate, Time } from "@alydev/core";

Core exports

@alydev/core also exports generateMonthGrid, buildDisabledPredicate, nearestEnabledDate, selection-strategy helpers, date comparison and range helpers, localized digit helpers, formatTokens, parseTokens, and the core calendar/date/selection types.

On this page