Accordion and AccordionGroup
The Accordion component creates collapsible sections of content that can be toggled open/closed. AccordionGroup allows grouping multiple accordions together.
Props
Accordion Props
title
(required): The main text displayed in the headerdescription
(optional): Secondary text shown below the titledefaultOpen
(optional): Whether the accordion is initially expanded (default: false)icon
(optional): React node to display as an icon on the leftonChange
(optional): Callback function triggered when accordion state changeschildren
(required): Content to show when accordion is expanded
AccordionGroup Props
children
(required): Collection of Accordion components to group together
Example
Usage
import { Accordion, AccordionGroup } from "@site/src/components/Extras/Accordion"
<Accordion
title="Wingardium Leviosa"
description="Basic levitation spell"
defaultOpen={false}
icon={<FaFly/>}
onChange={(isOpen) => console.log('Accordion state:', isOpen)}
>
A charm used to make objects fly. Remember Hermione's advice - it's Wing-gar-dium Levi-o-sa, not Levio-sar!
</Accordion>
<AccordionGroup>
<Accordion title="Polyjuice Potion" description="Complex transformation brew">
A complicated potion that allows the drinker to assume the appearance of another person.
</Accordion>
<Accordion title="Felix Felicis">
Also known as 'Liquid Luck', this golden potion makes the drinker lucky for a period of time.
</Accordion>
</AccordionGroup>