Calendar month

A calendar month component allows users to select and navigate between days, months, and years.

Examples

Selectable date

Select your favorite date

SundayMondayTuesdayWednesdayThursdayFridaySaturday
Selected date: Tue Nov 24 2020 00:00:00 GMT+0000 (Coordinated Universal Time)

Date range

In this example, there are 2 dates selected: a range start date (via the rangeStart prop) and a range end date (via the date prop). Additionally, any dates prior to the range start date are disabled by passing in an array of functions to the validators prop. In this case a single function is passed in, which checks whether a date is greater than or equal to the range start date.

For this example, these dates are static and cannot be updated. For an interactive demo, see our Date picker demos.

Calendar month displaying a range

SundayMondayTuesdayWednesdayThursdayFridaySaturday

Props

CalendarMonth

The main calendar month component.
*required
NameTypeDefaultDescription
cellAriaLabel(date: Date) => stringAccessible label for the date cells.
classNamestringAdditional classes to add to the outer div of the calendar month.
dateDateMonth/year to base other dates around.
dayFormat(date: Date) => React.ReactNode(date) => date.getDate()How to format days in buttons in table cells.
inlinePropsCalendarMonthInlinePropsProps used to ensure accessibility when displaying the calendar month inline.
isDateFocusedbooleanfalseFlag to set browser focus on the passed date. *
localestringundefinedIf using the default formatters which locale to use. Undefined defaults to current locale. See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#Locale_identification_and_negotiation
longWeekdayFormat(date: Date) => React.ReactNode(date) => date.toLocaleDateString(locale, { weekday: 'long' })How to format days in header for screen readers.
monthFormat(date: Date) => React.ReactNode(date) => date.toLocaleDateString(locale, { month: 'long' })How to format months in month select.
nextMonthAriaLabelstring'Next month'Accessible label for the next month button.
onChange(event: React.MouseEvent<HTMLButtonElement, MouseEvent>, date: Date) => void() => {}Callback when date is selected.
onMonthChange( event?: React.MouseEvent | React.ChangeEvent | React.FormEvent<HTMLInputElement>, newDate?: Date ) => void() => {}Callback when month or year is changed.
prevMonthAriaLabelstring'Previous month'Accessible label for the previous month button.
rangeStartDateWhich date to start range styles from.
validators((date: Date) => boolean)[][() => true]Functions that returns if a date is valid and selectable.
weekdayFormat(date: Date) => React.ReactNode(date) => date.toLocaleDateString(locale, { weekday: 'narrow' })How to format week days in header.
weekStart0 | 1 | 2 | 3 | 4 | 5 | 6 | Weekday0Day of week that starts the week. 0 is Sunday, 6 is Saturday.
yearInputAriaLabelstring'Select year'Accessible label for the year input.

CalendarFormat

Additional properties that extend from and can be passed to the main component. These properties allow customizing the calendar formatting and aria-labels.
*required
NameTypeDefaultDescription
cellAriaLabel(date: Date) => stringAccessible label for the date cells.
dayFormat(date: Date) => React.ReactNodeHow to format days in buttons in table cells.
inlinePropsCalendarMonthInlinePropsProps used to ensure accessibility when displaying the calendar month inline.
localestringIf using the default formatters which locale to use. Undefined defaults to current locale. See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#Locale_identification_and_negotiation
longWeekdayFormat(date: Date) => React.ReactNodeHow to format days in header for screen readers.
monthFormat(date: Date) => React.ReactNodeHow to format months in month select.
nextMonthAriaLabelstringAccessible label for the next month button.
prevMonthAriaLabelstringAccessible label for the previous month button.
rangeStartDateWhich date to start range styles from.
weekdayFormat(date: Date) => React.ReactNodeHow to format week days in header.
weekStart0 | 1 | 2 | 3 | 4 | 5 | 6 | WeekdayDay of week that starts the week. 0 is Sunday, 6 is Saturday.
yearInputAriaLabelstringAccessible label for the year input.

CalendarMonthInlineProps

*required
NameTypeDefaultDescription
ariaLabelledbystringId of the accessible label of the calendar month. Recommended to map to the title.
componentkeyof JSX.IntrinsicElementsComponent wrapping the calendar month when used inline. Recommended to be 'article'.
titleReact.ReactNodeTitle of the calendar rendered above the inline calendar month. Recommended to be a 'title' component.

CSS variables

Expand or collapse columnSelectorVariableValue
.pf-v6-c-calendar-month--pf-v6-c-calendar-month--BackgroundColor
(In light theme) #ffffff
.pf-v6-c-calendar-month--pf-v6-c-calendar-month--PaddingBlockStart
1.5rem
.pf-v6-c-calendar-month--pf-v6-c-calendar-month--PaddingInlineEnd
1.5rem
.pf-v6-c-calendar-month--pf-v6-c-calendar-month--PaddingBlockEnd
1rem
.pf-v6-c-calendar-month--pf-v6-c-calendar-month--PaddingInlineStart
1.5rem
.pf-v6-c-calendar-month--pf-v6-c-calendar-month--FontSize
0.875rem
.pf-v6-c-calendar-month--pf-v6-c-calendar-month__header--MarginBlockEnd
1rem
.pf-v6-c-calendar-month--pf-v6-c-calendar-month__header--Gap
0.25rem
.pf-v6-c-calendar-month--pf-v6-c-calendar-month__header-year--Width
9ch
.pf-v6-c-calendar-month--pf-v6-c-calendar-month__header-nav-control--MarginInlineEnd
0
.pf-v6-c-calendar-month--pf-v6-c-calendar-month__header-nav-control--MarginInlineStart
0
.pf-v6-c-calendar-month--pf-v6-c-calendar-month__days--BorderBlockEndWidth
1px
.pf-v6-c-calendar-month--pf-v6-c-calendar-month__days--BorderBlockEndColor
(In light theme) #c7c7c7
.pf-v6-c-calendar-month--pf-v6-c-calendar-month__day--PaddingBlockEnd
1rem
.pf-v6-c-calendar-month--pf-v6-c-calendar-month__day--FontWeight
400
.pf-v6-c-calendar-month--pf-v6-c-calendar-month__day--Color
(In light theme) #151515
.pf-v6-c-calendar-month--pf-v6-c-calendar-month__dates-cell--PaddingBlockStart
0.125rem
.pf-v6-c-calendar-month--pf-v6-c-calendar-month__dates-cell--PaddingInlineEnd
0.125rem
.pf-v6-c-calendar-month--pf-v6-c-calendar-month__dates-cell--PaddingBlockEnd
0.125rem
.pf-v6-c-calendar-month--pf-v6-c-calendar-month__dates-cell--PaddingInlineStart
0.125rem
.pf-v6-c-calendar-month--pf-v6-c-calendar-month__dates-row--first-child__dates-cell--PaddingBlockStart
0.5rem
.pf-v6-c-calendar-month--pf-v6-c-calendar-month__dates-cell--m-current__date--BackgroundColor
(In light theme) #f2f2f2
.pf-v6-c-calendar-month--pf-v6-c-calendar-month__dates-cell--m-selected__date--BackgroundColor
(In light theme) #0066cc
.pf-v6-c-calendar-month--pf-v6-c-calendar-month__dates-cell--m-selected__date--hover--BackgroundColor
(In light theme) #0066cc
.pf-v6-c-calendar-month--pf-v6-c-calendar-month__dates-cell--m-selected__date--focus--BackgroundColor
(In light theme) #0066cc
.pf-v6-c-calendar-month--pf-v6-c-calendar-month__dates-cell--m-selected__date--focus--after--BorderColor
(In light theme) #0066cc
.pf-v6-c-calendar-month--pf-v6-c-calendar-month__dates-cell--m-selected__date--Color
(In light theme) #ffffff
.pf-v6-c-calendar-month--pf-v6-c-calendar-month__dates-cell--before--BackgroundColor
transparent
.pf-v6-c-calendar-month--pf-v6-c-calendar-month__dates-cell--before--InsetBlockStart
0
.pf-v6-c-calendar-month--pf-v6-c-calendar-month__dates-cell--before--InsetInlineEnd
0
.pf-v6-c-calendar-month--pf-v6-c-calendar-month__dates-cell--before--InsetBlockEnd
0.125rem
.pf-v6-c-calendar-month--pf-v6-c-calendar-month__dates-cell--before--InsetInlineStart
0
.pf-v6-c-calendar-month--pf-v6-c-calendar-month__dates-cell--m-in-range--before--BackgroundColor
(In light theme) #f2f2f2
.pf-v6-c-calendar-month--pf-v6-c-calendar-month__dates-cell--m-in-range--m-start-range--before--InsetInlineStart
50%
.pf-v6-c-calendar-month--pf-v6-c-calendar-month__dates-cell--m-in-range--m-end-range--before--InsetInlineEnd
50%
.pf-v6-c-calendar-month--pf-v6-c-calendar-month__dates-cell--m-in-range__date--hover--BackgroundColor
(In light theme) #f2f2f2
.pf-v6-c-calendar-month--pf-v6-c-calendar-month__dates-cell--m-in-range__date--hover--BorderWidth
1px
.pf-v6-c-calendar-month--pf-v6-c-calendar-month__dates-cell--m-in-range__date--hover--BorderColor
(In light theme) #4394e5
.pf-v6-c-calendar-month--pf-v6-c-calendar-month__dates-cell--m-in-range__date--focus--BackgroundColor
(In light theme) #f2f2f2
.pf-v6-c-calendar-month--pf-v6-c-calendar-month__dates-cell--m-adjacent-month__date--Color
(In light theme) #4d4d4d
.pf-v6-c-calendar-month--pf-v6-c-calendar-month__date--Width
4ch
.pf-v6-c-calendar-month--pf-v6-c-calendar-month__date--Height
4ch
.pf-v6-c-calendar-month--pf-v6-c-calendar-month__date--BorderRadius
24px
.pf-v6-c-calendar-month--pf-v6-c-calendar-month__date--Color
(In light theme) #151515
.pf-v6-c-calendar-month--pf-v6-c-calendar-month__date--BackgroundColor
transparent
.pf-v6-c-calendar-month--pf-v6-c-calendar-month__date--disabled--BackgroundColor
(In light theme) #c7c7c7
.pf-v6-c-calendar-month--pf-v6-c-calendar-month__date--disabled--Color
(In light theme) #4d4d4d
.pf-v6-c-calendar-month--pf-v6-c-calendar-month__date--after--BorderWidth
1px
.pf-v6-c-calendar-month--pf-v6-c-calendar-month__date--after--BorderColor
transparent
.pf-v6-c-calendar-month--pf-v6-c-calendar-month__date--after--OutlineOffset
0
.pf-v6-c-calendar-month--pf-v6-c-calendar-month__date--hover--BackgroundColor
(In light theme) #f2f2f2
.pf-v6-c-calendar-month--pf-v6-c-calendar-month__date--hover--BorderWidth
1px
.pf-v6-c-calendar-month--pf-v6-c-calendar-month__date--hover--BorderColor
(In light theme) #4394e5
.pf-v6-c-calendar-month--pf-v6-c-calendar-month__date--focus--Color
(In light theme) #ffffff
.pf-v6-c-calendar-month--pf-v6-c-calendar-month__date--focus--BackgroundColor
(In light theme) #0066cc
.pf-v6-c-calendar-month--pf-v6-c-calendar-month__date--focus--after--BorderColor
(In light theme) #4394e5
.pf-v6-c-calendar-month--pf-v6-c-calendar-month__date--after--focus--OutlineOffset
-2px
.pf-v6-c-calendar-month__dates-row:first-child--pf-v6-c-calendar-month__dates-cell--PaddingBlockStart
0.5rem
.pf-v6-c-calendar-month__dates-cell--pf-v6-c-calendar-month__dates-cell--before--InsetBlockStart
0.125rem
.pf-v6-c-calendar-month__dates-cell.pf-m-current--pf-v6-c-calendar-month__date--BackgroundColor
(In light theme) #f2f2f2
.pf-v6-c-calendar-month__dates-cell.pf-m-in-range--pf-v6-c-calendar-month__dates-cell--before--BackgroundColor
(In light theme) #f2f2f2
.pf-v6-c-calendar-month__dates-cell.pf-m-in-range--pf-v6-c-calendar-month__date--hover--BackgroundColor
(In light theme) #f2f2f2
.pf-v6-c-calendar-month__dates-cell.pf-m-in-range--pf-v6-c-calendar-month__date--hover--BorderWidth
1px
.pf-v6-c-calendar-month__dates-cell.pf-m-in-range--pf-v6-c-calendar-month__date--hover--BorderColor
(In light theme) #4394e5
.pf-v6-c-calendar-month__dates-cell.pf-m-in-range--pf-v6-c-calendar-month__date--focus--BackgroundColor
(In light theme) #f2f2f2
.pf-v6-c-calendar-month__dates-cell.pf-m-start-range--pf-v6-c-calendar-month__dates-cell--before--InsetInlineStart
50%
.pf-v6-c-calendar-month__dates-cell.pf-m-end-range--pf-v6-c-calendar-month__dates-cell--before--InsetInlineEnd
50%
.pf-v6-c-calendar-month__dates-cell.pf-m-adjacent-month--pf-v6-c-calendar-month__date--Color
(In light theme) #4d4d4d
.pf-v6-c-calendar-month__dates-cell.pf-m-selected--pf-v6-c-calendar-month__date--BackgroundColor
(In light theme) #0066cc
.pf-v6-c-calendar-month__dates-cell.pf-m-selected--pf-v6-c-calendar-month__date--Color
(In light theme) #ffffff
.pf-v6-c-calendar-month__dates-cell.pf-m-selected--pf-v6-c-calendar-month__date--hover--BackgroundColor
(In light theme) #0066cc
.pf-v6-c-calendar-month__dates-cell.pf-m-selected--pf-v6-c-calendar-month__date--hover--BorderWidth
0
.pf-v6-c-calendar-month__dates-cell.pf-m-selected--pf-v6-c-calendar-month__date--focus--BackgroundColor
(In light theme) #0066cc
.pf-v6-c-calendar-month__dates-cell.pf-m-selected--pf-v6-c-calendar-month__date--focus--after--BorderColor
(In light theme) #0066cc
.pf-v6-c-calendar-month__dates-cell.pf-m-selected--pf-v6-c-calendar-month__date--after--OutlineOffset
-2px
.pf-v6-c-calendar-month__dates-cell.pf-m-disabled--pf-v6-c-calendar-month__dates-cell--before--BackgroundColor
transparent
.pf-v6-c-calendar-month__dates-cell.pf-m-disabled--pf-v6-c-calendar-month__date--BackgroundColor
transparent
.pf-v6-c-calendar-month__date:hover--pf-v6-c-calendar-month__date--BackgroundColor
(In light theme) #f2f2f2
.pf-v6-c-calendar-month__date:focus--pf-v6-c-calendar-month__date--after--BorderColor
(In light theme) #4394e5
.pf-v6-c-calendar-month__date:disabled--pf-v6-c-calendar-month__date--BackgroundColor
(In light theme) #c7c7c7
.pf-v6-c-calendar-month__date:disabled--pf-v6-c-calendar-month__date--Color
(In light theme) #4d4d4d
.pf-v6-c-calendar-month__date:disabled--pf-v6-c-calendar-month__date--hover--focus--BorderColor
transparent