diff --git a/src/components/Accordion/Accordion.stories.tsx b/src/components/Accordion/Accordion.stories.tsx index 75a656b7..4c7bccfd 100644 --- a/src/components/Accordion/Accordion.stories.tsx +++ b/src/components/Accordion/Accordion.stories.tsx @@ -9,13 +9,23 @@ export default { argTypes: { type: { defaultValue: 'single', + control: { + type: 'select', + }, + options: ['single', 'multiple'], + description: 'Defines the policy for how many items can be open', + }, + collapsible: { + defaultValue: true, + control: { + type: 'boolean', + }, + description: 'In single mode only, declares that they can all be closed.', }, }, } as Meta -export const Default: Story> = ({ - ...args -}) => { +export const Default: Story = ({ ...args }) => { return ( diff --git a/src/components/Accordion/Accordion.tsx b/src/components/Accordion/Accordion.tsx index a353ff42..d586fc10 100644 --- a/src/components/Accordion/Accordion.tsx +++ b/src/components/Accordion/Accordion.tsx @@ -39,16 +39,20 @@ type AccordionProps = Partial> & CSSProps export const Accordion = forwardRef( - ({ collapsible = true, type = 'single', ...props }, forwardedRef) => ( - - ) + ({ collapsible = true, type = 'single', ...props }, forwardedRef) => { + let additionalProps = {} + if (type == 'single' && collapsible) { + additionalProps = { collapsible: true } + } + return ( + + ) + } ) as Polymorphic.ForwardRefComponent< Polymorphic.IntrinsicElement, AccordionProps