Accordion

A component used to create collapsible content that can be hidden and shown again.

Preview

Basic Usage

This is a simple accordion component that can be toggled by clicking the header. The content can include any valid React nodes, including text, components, and markdown.

With Code Block

With Markdown Content

Props

PropTypeDefaultDescription
titlestring-Required. The text displayed in the accordion header.
childrenReactNodenullThe content to be displayed when the accordion is expanded. Can be plain text, markdown, or React components.
defaultOpenbooleanfalseWhen true, the accordion will be expanded by default.
classNamestringundefinedAdditional CSS classes to apply to the accordion container.

Output Markdown

<Accordion title="Markdown">
    this is an example of plain text content from the accordion component and below is markdown ;
    1. number one
    2. number two
    3. number three
</Accordion>

Published on Dec 22, 2024