Loading...
Installation
Install the following dependencies:
Copy and paste the following code into your project.
Loading...
Update the import paths to match your project setup.
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
| Prop | Type | Default | Description |
|---|---|---|---|
id | string | undefined | — | Unique identifier used to connect the component parts. |
locale | string | undefined | — | Configures locale. |
createCalendar | ((identifier: CalendarIdentifier) => Calendar) | undefined | — | Configures create calendar. |
translations | IntlTranslations | undefined | — | Configures translations. |
ids | ElementIds | undefined | — | Overrides generated identifiers for individual parts. |
name | string | undefined | — | Name used when submitting the value with a form. |
timeZone | string | undefined | — | Configures time zone. |
disabled | boolean | undefined | false | Disables interaction with the component. |
readOnly | boolean | undefined | false | Prevents changes while preserving focus and navigation. |
required | boolean | undefined | false | Marks the associated form control as required. |
invalid | boolean | undefined | — | Marks the associated form control as invalid. |
outsideDaySelectable | boolean | undefined | — | Configures outside day selectable. |
min | DateValue | undefined | — | Configures min. |
max | DateValue | undefined | — | Configures max. |
closeOnSelect | boolean | undefined | true | Configures close on select. |
openOnClick | boolean | undefined | — | Configures open on click. |
value | DateValue[] | undefined | — | Current value when the component is controlled. |
defaultValue | DateValue[] | undefined | — | Initial value when the component is uncontrolled. |
focusedValue | DateValue | undefined | — | Configures focused value. |
defaultFocusedValue | DateValue | undefined | — | Configures default focused value. |
numOfMonths | number | undefined | — | Configures num of months. |
startOfWeek | number | undefined | — | Configures start of week. |
fixedWeeks | boolean | undefined | — | Configures fixed weeks. |
showWeekNumbers | boolean | 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. |
selectionMode | SelectionMode | undefined | — | Configures selection mode. |
maxSelectedDates | number | undefined | — | Configures max selected dates. |
format | ((date: DateValue, details: LocaleDetails) => string) | undefined | — | Configures format. |
parse | ((value: string, details: LocaleDetails) => DateValue | undefined) | undefined | — | Configures parse. |
placeholder | string | undefined | — | Configures placeholder. |
view | DateView | undefined | — | Configures view. |
defaultView | DateView | undefined | — | Configures default view. |
minView | DateView | undefined | — | Configures min view. |
maxView | DateView | undefined | — | Configures max view. |
positioning | PositioningOptions | undefined | — | Configures floating-element placement and collision handling. |
open | boolean | undefined | — | Whether the component is open when controlled. |
defaultOpen | boolean | undefined | — | Initial open state when uncontrolled. |
inline | boolean | undefined | — | Configures inline. |
Context, Hooks, and Types
| Export | API |
|---|---|
useCalendar | Creates or accesses the component API. |
useCalendarContext | Returns the nearest component API. |
CalendarValueChangeDetails | Type for the details object passed to the matching change callback. |
CalendarOpenChangeDetails | Type for the details object passed to the matching change callback. |
Utilities and Supporting Types
| Export | API |
|---|---|
CalendarDate | Supporting type or utility exported with the component. |
getLocalTimeZone | Returns the current local IANA time-zone identifier. |
today | Returns today's calendar date in a time zone. |
DateValue | Supporting type or utility exported with the component. |
Angular
React
Solid
Svelte
Vue