Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions packages/react-calendar/src/Calendar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,12 @@ export type CalendarProps = {
* @example true
*/
allowPartialRange?: boolean;
/**
* `aria-label` attribute of the calendar container.
*
* @example 'Calendar'
*/
ariaLabel?: string;
/**
* Type of calendar that should be used. Can be `'gregory`, `'hebrew'`, `'islamic'`, `'iso8601'`. Setting to `"gregory"` or `"hebrew"` will change the first day of the week to Sunday. Setting to `"islamic"` will change the first day of the week to Saturday. Setting to `"islamic"` or `"hebrew"` will make weekends appear on Friday to Saturday.
*
Expand Down Expand Up @@ -328,6 +334,13 @@ export type CalendarProps = {
* @example 'range'
*/
returnValue?: 'start' | 'end' | 'range';
/**
* The WAI-ARIA role of the calendar.
*
* @default 'dialog'
* @example 'dialog'
*/
role?: React.AriaRole;
/**
* Whether the user shall select two dates forming a range instead of just one. **Note**: This feature will make react-calendar return array with two dates regardless of returnValue setting.
*
Expand Down Expand Up @@ -602,6 +615,7 @@ const Calendar: React.ForwardRefExoticComponent<CalendarProps & React.RefAttribu
const {
activeStartDate: activeStartDateProps,
allowPartialRange,
ariaLabel,
calendarType,
className,
defaultActiveStartDate,
Expand Down Expand Up @@ -643,6 +657,7 @@ const Calendar: React.ForwardRefExoticComponent<CalendarProps & React.RefAttribu
prevAriaLabel,
prevLabel,
returnValue = 'start',
role = 'dialog',
selectRange,
showDoubleView,
showFixedNumberOfWeeks,
Expand Down Expand Up @@ -1124,6 +1139,8 @@ const Calendar: React.ForwardRefExoticComponent<CalendarProps & React.RefAttribu
className,
)}
ref={inputRef}
role={role}
aria-label={ariaLabel}
>
{renderNavigation()}
<div
Expand Down