Search documentation

Search the documentation and open a page.

A calendar component for selecting dates, ranges, and multiple dates.

Loading...

Installation

pnpm dlx shadcn@latest add @wirekyt/calendar

Composition

Calendar ├── CalendarViewHeader │ └── CalendarSelectHeader (optional) ├── CalendarDayView | CalendarDualMonthDayView │ └── CalendarDayTable │ └── CalendarDayButton ├── CalendarMonthView | CalendarYearView └── CalendarPresetTrigger (optional)

Examples

Default

Loading...

Month Year Selector

Loading...

Presets

Loading...

Range Vertical

Loading...

Range With Presets

Loading...

Range

Loading...

API Reference

Calendar

PropTypeDefaultDescription
idstring | undefined—Unique identifier used to connect the component parts.
localestring | undefined—Configures locale.
createCalendar((identifier: CalendarIdentifier) => Calendar) | undefined—Configures create calendar.
translationsIntlTranslations | undefined—Configures translations.
idsElementIds | undefined—Overrides generated identifiers for individual parts.
namestring | undefined—Name used when submitting the value with a form.
timeZonestring | undefined—Configures time zone.
disabledboolean | undefinedfalseDisables interaction with the component.
readOnlyboolean | undefinedfalsePrevents changes while preserving focus and navigation.
requiredboolean | undefinedfalseMarks the associated form control as required.
invalidboolean | undefined—Marks the associated form control as invalid.
outsideDaySelectableboolean | undefined—Configures outside day selectable.
minDateValue | undefined—Configures min.
maxDateValue | undefined—Configures max.
closeOnSelectboolean | undefinedtrueConfigures close on select.
openOnClickboolean | undefined—Configures open on click.
valueDateValue[] | undefined—Current value when the component is controlled.
defaultValueDateValue[] | undefined—Initial value when the component is uncontrolled.
focusedValueDateValue | undefined—Configures focused value.
defaultFocusedValueDateValue | undefined—Configures default focused value.
numOfMonthsnumber | undefined—Configures num of months.
startOfWeeknumber | undefined—Configures start of week.
fixedWeeksboolean | undefined—Configures fixed weeks.
showWeekNumbersboolean | undefined—Configures show week numbers.
onValueChange((details: ValueChangeDetails) => void) | undefined—Runs when value changes.
onFocusChange((details: FocusChangeDetails) => void) | undefined—Runs when focus changes.
onViewChange((details: ViewChangeDetails) => void) | undefined—Runs when view changes.
onVisibleRangeChange((details: VisibleRangeChangeDetails) => void) | undefined—Runs when visible range changes.
onOpenChange((details: OpenChangeDetails) => void) | undefined—Runs when open changes.
isDateUnavailable((date: DateValue, locale: string) => boolean) | undefined—Configures is date unavailable.
selectionModeSelectionMode | undefined—Configures selection mode.
maxSelectedDatesnumber | undefined—Configures max selected dates.
format((date: DateValue, details: LocaleDetails) => string) | undefined—Configures format.
parse((value: string, details: LocaleDetails) => DateValue | undefined) | undefined—Configures parse.
placeholderstring | undefined—Configures placeholder.
viewDateView | undefined—Configures view.
defaultViewDateView | undefined—Configures default view.
minViewDateView | undefined—Configures min view.
maxViewDateView | undefined—Configures max view.
positioningPositioningOptions | undefined—Configures floating-element placement and collision handling.
openboolean | undefined—Whether the component is open when controlled.
defaultOpenboolean | undefined—Initial open state when uncontrolled.
inlineboolean | undefined—Configures inline.

Context, Hooks, and Types

ExportAPI
useCalendarCreates or accesses the component API.
useCalendarContextReturns the nearest component API.
CalendarValueChangeDetailsType for the details object passed to the matching change callback.
CalendarOpenChangeDetailsType for the details object passed to the matching change callback.

Utilities and Supporting Types

ExportAPI
CalendarDateSupporting type or utility exported with the component.
getLocalTimeZoneReturns the current local IANA time-zone identifier.
todayReturns today's calendar date in a time zone.
DateValueSupporting type or utility exported with the component.