Accordion

An accordion is an interactive heading that reveals an associated section of content when clicked. It can be grouped together with multiple accordions using the AccordionGroup component.

Props

NameDefaultType
openboolean
Controls whether the accordion is open from the outside
labelstring
If provided, the accordion will display the text in the header
cardboolean
If set as true, the accordion will look like the card component
unstyledfalseboolean
Removes default styling and allows fully custom trigger/content styling

Events

NamePayloadType
openCalled whenever the accordion opens
closeCalled when the accordion closes

Slots

NameAcceptsDescription
defaultanyThe content inside the accordion
triggeranyAllows user to define custom header which opens the accordion when clicked. It will replace the label prop if provided. This slot also exposes all the properties defined in the Exposes section

Exposes

When queries via useTemplateRef, this component exposes

NameTypeUsage
openmethodWhen called, the accordion will open
closemethodWhen called, the accordion will close
togglemethodToggles between opened and closed state
isOpenRef<booleanRef which tracks whether the boolean is open or not

Examples

The following example shows the implementation of an unstyled element with a custom header.