Accordion Component

An Accordion is a web component that allows users to expand or collapse content sections to save space and simplify navigation.

Installation

Ensure that have the @zyxui library installed in your project:

If you haven't install and setup @zyxui before please follow the installation guide

Basic Accordion

To create a basic accordion, simply write this code below:

This is content of Item One

Customization

Personalize your accordion component with ease using our provided props.

Variants

Our Accordion component currently offers two distinct variants: default and bordered.

Default Variant

This is content of Item One

Bordered Variant

This is content of Item One

Multiple

Multiple openable accordions allow you to expand more than one section at a time, providing flexible content access.

the default value is false, so you will need to pass multiple props as true

Multiple Accordion

This is content of Item One

Sizes

The Accordion component also comes in different sizes, offering customization options by using the size prop with sm, md, or lg`.

Small Size Accordion

This is content of Item One

Medium Size Accordion (The default size)

This is content of Item One

Large Size Accordion

This is content of Item One

Icon Position

You can easily change the position of the accordion icon to either the start or the end as per your preference. The default value is end

Start Icon Position

This is content of Item One

API Reference

PropertyDescriptionTypeDefault
itemsAccordion items{id: number | string; title: string; content: ReactNode}[][]
variantChange accordion base styles.default | bordereddefault
sizeAccordion size.ms | md | lgmd
multipleMultiple openable items.booleanfalse
iconPositionChange accordion icon position.start | endend
classNameAdding custom class names to your accordion.stringundefined