Calendar API
View componentThe full prop reference for the Calendar component. A standalone calendar for selecting dates.
Import
import { Calendar } from '@structyl/styled';Props
Calendar (styled)
Ready-to-use calendar component with built-in layout, styling, and navigation controls
| Prop | Type | Default |
|---|---|---|
| mode# | 'single' | 'range' | 'multiple'Selection mode: single date, date range, or multiple dates | 'single' |
| selected# | Date | Date[] | { from?: Date; to?: Date } | undefinedSelected value (controlled); shape depends on mode | — |
| defaultSelected# | Date | Date[] | { from?: Date; to?: Date } | undefinedInitial selected value (uncontrolled) | — |
| onSelect# | (value: Date | Date[] | { from?: Date; to?: Date } | undefined) => voidCallback fired when selection changes | — |
| month# | DateDisplayed month (controlled) | — |
| defaultMonth# | DateInitial month (uncontrolled); defaults to month of selected value or today | — |
| onMonthChange# | (month: Date) => voidCallback fired when displayed month changes | — |
| minDate# | DateEarliest selectable date (inclusive) | — |
| maxDate# | DateLatest selectable date (inclusive) | — |
| disablePast# | booleanDisable all dates before today | — |
| disableFuture# | booleanDisable all dates after today | — |
| disabled# | booleanDisable entire calendar | — |
| disabledDays# | (date: Date) => booleanPredicate to disable specific dates | — |
| shouldDisableDate# | (date: Date) => booleanPredicate to disable specific dates (alternative to disabledDays) | — |
| shouldDisableMonth# | (date: Date) => booleanPredicate to disable months for month/year navigation | — |
| shouldDisableYear# | (date: Date) => booleanPredicate to disable years for month/year navigation | — |
| weekStartsOn# | numberFirst day of week (0=Sunday, 1=Monday, etc) | 0 |
| locale# | stringBCP 47 locale code for formatting dates and day names | — |
| disableHighlightToday# | booleanDon't highlight today's date | — |
| displayWeekNumber# | booleanShow ISO week numbers in grid | — |
| fixedWeekNumber# | numberFixed number of weeks to display (pads with next/prev month dates) | — |
| showOutsideDays# | booleanShow dates from adjacent months in calendar grid | true |
| dayOfWeekFormatter# | (date: Date) => stringCustom formatter for weekday headers | — |
| onYearChange# | (year: Date) => voidCallback fired when displayed year changes | — |
| className# | stringAdditional CSS classes | — |
| asChild# | booleanRender as child of another component | — |
Calendar.Root (primitive)
Headless calendar root providing selection state and context
| Prop | Type | Default |
|---|---|---|
| mode# | 'single' | 'range' | 'multiple'Selection mode: single date, date range, or multiple dates | 'single' |
| selected# | Date | Date[] | { from?: Date; to?: Date } | undefinedSelected value (controlled); shape depends on mode | — |
| defaultSelected# | Date | Date[] | { from?: Date; to?: Date } | undefinedInitial selected value (uncontrolled) | — |
| onSelect# | (value: Date | Date[] | { from?: Date; to?: Date } | undefined) => voidCallback fired when selection changes | — |
| month# | DateDisplayed month (controlled) | — |
| defaultMonth# | DateInitial month (uncontrolled); defaults to month of selected value or today | — |
| onMonthChange# | (month: Date) => voidCallback fired when displayed month changes | — |
| minDate# | DateEarliest selectable date (inclusive) | — |
| maxDate# | DateLatest selectable date (inclusive) | — |
| disablePast# | booleanDisable all dates before today | — |
| disableFuture# | booleanDisable all dates after today | — |
| disabled# | booleanDisable entire calendar | — |
| disabledDays# | (date: Date) => booleanPredicate to disable specific dates | — |
| shouldDisableDate# | (date: Date) => booleanPredicate to disable specific dates (alternative to disabledDays) | — |
| shouldDisableMonth# | (date: Date) => booleanPredicate to disable months for month/year navigation | — |
| shouldDisableYear# | (date: Date) => booleanPredicate to disable years for month/year navigation | — |
| weekStartsOn# | numberFirst day of week (0=Sunday, 1=Monday, etc) | 0 |
| locale# | stringBCP 47 locale code for formatting dates and day names | — |
| disableHighlightToday# | booleanDon't highlight today's date | — |
| displayWeekNumber# | booleanShow ISO week numbers in grid | — |
| fixedWeekNumber# | numberFixed number of weeks to display (pads with next/prev month dates) | — |
| dayOfWeekFormatter# | (date: Date) => stringCustom formatter for weekday headers | — |
| onYearChange# | (year: Date) => voidCallback fired when displayed year changes | — |
| className# | stringAdditional CSS classes | — |
| asChild# | booleanRender as child of another component | — |
Calendar.Header
Container for calendar header controls (previous, heading, next buttons)
| Prop | Type | Default |
|---|---|---|
| className# | stringAdditional CSS classes | — |
Calendar.PreviousButton
Button to navigate to previous month
| Prop | Type | Default |
|---|---|---|
| onClick# | (event: React.MouseEvent<HTMLButtonElement>) => voidClick handler (composition automatically adds previous month navigation) | — |
| className# | stringAdditional CSS classes | — |
Calendar.NextButton
Button to navigate to next month
| Prop | Type | Default |
|---|---|---|
| onClick# | (event: React.MouseEvent<HTMLButtonElement>) => voidClick handler (composition automatically adds next month navigation) | — |
| className# | stringAdditional CSS classes | — |
Calendar.Heading
Displays current month and year with live region updates
| Prop | Type | Default |
|---|---|---|
| format# | Intl.DateTimeFormatOptionsDate format options for Intl.DateTimeFormat | { month: 'long', year: 'numeric' } |
| locale# | stringLocale override for formatting (falls back to Calendar.Root locale) | — |
| className# | stringAdditional CSS classes | — |
Calendar.GridHead
Table header displaying day-of-week labels
| Prop | Type | Default |
|---|---|---|
| format# | 'narrow' | 'short' | 'long'Day name format width | 'narrow' |
| locale# | stringLocale override for day name formatting | — |
| className# | stringAdditional CSS classes | — |
Calendar.GridBody
Table body rendering weeks and days using render function
| Prop | Type | Default |
|---|---|---|
| children# | (date: Date, props: { isOutsideMonth: boolean }) => React.ReactNodeRender function for each day cell | — |
| className# | stringAdditional CSS classes | — |
Calendar.Day
Individual day button with selection state and keyboard navigation
| Prop | Type | Default |
|---|---|---|
| date# | DateDate this button represents (required) | — |
| isOutsideMonth# | booleanWhether date is outside current displayed month | — |
| onClick# | (event: React.MouseEvent<HTMLButtonElement>) => voidClick handler (composition automatically adds date selection) | — |
| onKeyDown# | (event: React.KeyboardEvent<HTMLButtonElement>) => voidKeyboard handler (composition supports arrow keys, Page Up/Down, Home, End) | — |
| className# | stringAdditional CSS classes | — |
| disabled# | booleanDisables the day button | — |
Source code
If you didn't find what you need here, read the component implementation .