An accordion component. Used to create small pockets of additional information.
---import { Accordion, AccordionItem } from 'studiocms:ui/components/accordion';---
<Accordion> <AccordionItem open> <div slot="summary">This is the summary</div> <div>These are the details</div> </AccordionItem> <AccordionItem> <div slot="summary">This is the 2nd summary</div> <div>These are the 2nd details</div> </AccordionItem></Accordion>You can pass the open prop to any <AccordionItem> to have it be open by default, as seen above in the example.
The accordion component has multiple different styles:
outlined (Default)separatedfilledblankThey can be used via the style prop on the accordion parent. Here’s an accordion with the filled style:
---import { Accordion, AccordionItem } from 'studiocms:ui/components/accordion';---
<Accordion style="filled"> <AccordionItem open> <div slot="summary">This is the summary</div> <div>These are the details</div> </AccordionItem> <AccordionItem> <div slot="summary">This is the 2nd summary</div> <div>These are the 2nd details</div> </AccordionItem></Accordion>By default, users can open multiple items in the accordion at once. You can change this behavior by setting the multipleOpen prop on the <Accordion> element to false:
---import { Accordion, AccordionItem } from 'studiocms:ui/components/accordion';---
<Accordion multipleOpen={false}> <AccordionItem open> <div slot="summary">This is the summary</div> <div>These are the details</div> </AccordionItem> <AccordionItem> <div slot="summary">This is the 2nd summary</div> <div>These are the 2nd details</div> </AccordionItem></Accordion>