Skip to content

Commit 2caf68f

Browse files
committed
feat(CalendarMonth): add select prop passthrough
1 parent ccad519 commit 2caf68f

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

packages/react-core/src/components/CalendarMonth/CalendarMonth.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { useEffect, useMemo, useRef, useState } from 'react';
22
import { TextInput } from '../TextInput';
33
import { Button } from '../Button';
4-
import { Select, SelectList, SelectOption } from '../Select';
4+
import { Select, SelectList, SelectOption, SelectProps } from '../Select';
55
import { MenuToggle, MenuToggleElement } from '../MenuToggle';
66
import { InputGroup, InputGroupItem } from '../InputGroup';
77
import RhMicronsCaretLeftIcon from '@patternfly/react-icons/dist/esm/icons/rh-microns-caret-left-icon';
@@ -81,6 +81,8 @@ export interface CalendarProps extends CalendarFormat, Omit<React.HTMLProps<HTML
8181
onSelectToggle?: (open: boolean) => void;
8282
/** Functions that returns if a date is valid and selectable. */
8383
validators?: ((date: Date) => boolean)[];
84+
/** Additional props passed to the month select component. */
85+
monthSelectProps?: SelectProps;
8486
}
8587

8688
const buildCalendar = (year: number, month: number, weekStart: number, validators: ((date: Date) => boolean)[]) => {
@@ -143,6 +145,7 @@ export const CalendarMonth = ({
143145
cellAriaLabel,
144146
isDateFocused = false,
145147
inlineProps,
148+
monthSelectProps,
146149
...props
147150
}: CalendarProps) => {
148151
const longMonths = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]
@@ -328,6 +331,7 @@ export const CalendarMonth = ({
328331
}}
329332
selected={monthFormatted}
330333
popperProps={{ appendTo: 'inline' }}
334+
{...monthSelectProps}
331335
>
332336
<SelectList>
333337
{longMonths.map((longMonth, index) => (

0 commit comments

Comments
 (0)