diff --git a/packages/accordion/src/index.tsx b/packages/accordion/src/index.tsx index e898dffe0..80c03ef41 100644 --- a/packages/accordion/src/index.tsx +++ b/packages/accordion/src/index.tsx @@ -153,7 +153,7 @@ export const Accordion = forwardRef( } const onSelectPanel = useCallback( - (index: AccordionIndex) => { + (index: number) => { onChange && onChange(index); if (!isControlled) { @@ -263,7 +263,7 @@ export type AccordionProps = Omit< * * @see Docs https://reacttraining.com/reach-ui/accordion#accordion-onchange */ - onChange?(index?: AccordionIndex): void; + onChange?(index?: number): void; /** * Whether or not an uncontrolled accordion is read-only or controllable by a * user interaction. @@ -614,7 +614,7 @@ type ButtonRef = React.MutableRefObject; type AccordionIndex = number | number[]; interface IAccordionContext { - accordionId: string; + accordionId: string | undefined; openPanels: AccordionIndex; onSelectPanel(index: AccordionIndex): void; readOnly: boolean; diff --git a/website/src/pages/accordion.mdx b/website/src/pages/accordion.mdx index ee3f12eda..6647d1ea1 100644 --- a/website/src/pages/accordion.mdx +++ b/website/src/pages/accordion.mdx @@ -330,7 +330,7 @@ Whether or not multiple panels in an uncontrolled accordion can be opened at the ##### Accordion `onChange` -`onChange?: (value: number | number[]) => void` +`onChange?: (value: number) => void` The callback that is fired when an accordion item's open state is changed.