structyl

Calendar API

View component

The full prop reference for the Calendar component. A standalone calendar for selecting dates.

Import

tsx
import { Calendar } from '@structyl/styled';

Props

Calendar (styled)

Ready-to-use calendar component with built-in layout, styling, and navigation controls

PropTypeDefault
mode#'single' | 'range' | 'multiple'

Selection mode: single date, date range, or multiple dates

'single'
selected#Date | Date[] | { from?: Date; to?: Date } | undefined

Selected value (controlled); shape depends on mode

defaultSelected#Date | Date[] | { from?: Date; to?: Date } | undefined

Initial selected value (uncontrolled)

onSelect#(value: Date | Date[] | { from?: Date; to?: Date } | undefined) => void

Callback fired when selection changes

month#Date

Displayed month (controlled)

defaultMonth#Date

Initial month (uncontrolled); defaults to month of selected value or today

onMonthChange#(month: Date) => void

Callback fired when displayed month changes

minDate#Date

Earliest selectable date (inclusive)

maxDate#Date

Latest selectable date (inclusive)

disablePast#boolean

Disable all dates before today

disableFuture#boolean

Disable all dates after today

disabled#boolean

Disable entire calendar

disabledDays#(date: Date) => boolean

Predicate to disable specific dates

shouldDisableDate#(date: Date) => boolean

Predicate to disable specific dates (alternative to disabledDays)

shouldDisableMonth#(date: Date) => boolean

Predicate to disable months for month/year navigation

shouldDisableYear#(date: Date) => boolean

Predicate to disable years for month/year navigation

weekStartsOn#number

First day of week (0=Sunday, 1=Monday, etc)

0
locale#string

BCP 47 locale code for formatting dates and day names

disableHighlightToday#boolean

Don't highlight today's date

displayWeekNumber#boolean

Show ISO week numbers in grid

fixedWeekNumber#number

Fixed number of weeks to display (pads with next/prev month dates)

showOutsideDays#boolean

Show dates from adjacent months in calendar grid

true
dayOfWeekFormatter#(date: Date) => string

Custom formatter for weekday headers

onYearChange#(year: Date) => void

Callback fired when displayed year changes

className#string

Additional CSS classes

asChild#boolean

Render as child of another component

Calendar.Root (primitive)

Headless calendar root providing selection state and context

PropTypeDefault
mode#'single' | 'range' | 'multiple'

Selection mode: single date, date range, or multiple dates

'single'
selected#Date | Date[] | { from?: Date; to?: Date } | undefined

Selected value (controlled); shape depends on mode

defaultSelected#Date | Date[] | { from?: Date; to?: Date } | undefined

Initial selected value (uncontrolled)

onSelect#(value: Date | Date[] | { from?: Date; to?: Date } | undefined) => void

Callback fired when selection changes

month#Date

Displayed month (controlled)

defaultMonth#Date

Initial month (uncontrolled); defaults to month of selected value or today

onMonthChange#(month: Date) => void

Callback fired when displayed month changes

minDate#Date

Earliest selectable date (inclusive)

maxDate#Date

Latest selectable date (inclusive)

disablePast#boolean

Disable all dates before today

disableFuture#boolean

Disable all dates after today

disabled#boolean

Disable entire calendar

disabledDays#(date: Date) => boolean

Predicate to disable specific dates

shouldDisableDate#(date: Date) => boolean

Predicate to disable specific dates (alternative to disabledDays)

shouldDisableMonth#(date: Date) => boolean

Predicate to disable months for month/year navigation

shouldDisableYear#(date: Date) => boolean

Predicate to disable years for month/year navigation

weekStartsOn#number

First day of week (0=Sunday, 1=Monday, etc)

0
locale#string

BCP 47 locale code for formatting dates and day names

disableHighlightToday#boolean

Don't highlight today's date

displayWeekNumber#boolean

Show ISO week numbers in grid

fixedWeekNumber#number

Fixed number of weeks to display (pads with next/prev month dates)

dayOfWeekFormatter#(date: Date) => string

Custom formatter for weekday headers

onYearChange#(year: Date) => void

Callback fired when displayed year changes

className#string

Additional CSS classes

asChild#boolean

Render as child of another component

Calendar.Header

Container for calendar header controls (previous, heading, next buttons)

PropTypeDefault
className#string

Additional CSS classes

Calendar.PreviousButton

Button to navigate to previous month

PropTypeDefault
onClick#(event: React.MouseEvent<HTMLButtonElement>) => void

Click handler (composition automatically adds previous month navigation)

className#string

Additional CSS classes

Calendar.NextButton

Button to navigate to next month

PropTypeDefault
onClick#(event: React.MouseEvent<HTMLButtonElement>) => void

Click handler (composition automatically adds next month navigation)

className#string

Additional CSS classes

Calendar.Heading

Displays current month and year with live region updates

PropTypeDefault
format#Intl.DateTimeFormatOptions

Date format options for Intl.DateTimeFormat

{ month: 'long', year: 'numeric' }
locale#string

Locale override for formatting (falls back to Calendar.Root locale)

className#string

Additional CSS classes

Calendar.Grid

Table wrapper for calendar days

PropTypeDefault
className#string

Additional CSS classes

Calendar.GridHead

Table header displaying day-of-week labels

PropTypeDefault
format#'narrow' | 'short' | 'long'

Day name format width

'narrow'
locale#string

Locale override for day name formatting

className#string

Additional CSS classes

Calendar.GridBody

Table body rendering weeks and days using render function

PropTypeDefault
children#(date: Date, props: { isOutsideMonth: boolean }) => React.ReactNode

Render function for each day cell

className#string

Additional CSS classes

Calendar.Day

Individual day button with selection state and keyboard navigation

PropTypeDefault
date#Date

Date this button represents (required)

isOutsideMonth#boolean

Whether date is outside current displayed month

onClick#(event: React.MouseEvent<HTMLButtonElement>) => void

Click handler (composition automatically adds date selection)

onKeyDown#(event: React.KeyboardEvent<HTMLButtonElement>) => void

Keyboard handler (composition supports arrow keys, Page Up/Down, Home, End)

className#string

Additional CSS classes

disabled#boolean

Disables the day button

Source code

If you didn't find what you need here, read the component implementation .

structyl — Accessible React Component Library