1. components
  2. accordion
  3. react

Accordion

Divide content into collapsible sections.

Default

Lorem ipsum dolor, sit amet consectetur adipisicing elit. Sit esse nisi eligendi fuga! Quas nisi repellat adipisci animi repellendus incidunt laborum sunt qui nesciunt, ducimus saepe sapiente sed ut labore. Lorem ipsum dolor, sit amet consectetur adipisicing elit. Sit esse nisi eligendi fuga! Quas nisi repellat adipisci animi repellendus incidunt laborum sunt qui nesciunt, ducimus saepe sapiente sed ut labore.



Collapsible

Lorem ipsum dolor, sit amet consectetur adipisicing elit. Sit esse nisi eligendi fuga! Quas nisi repellat adipisci animi repellendus incidunt laborum sunt qui nesciunt, ducimus saepe sapiente sed ut labore. Lorem ipsum dolor, sit amet consectetur adipisicing elit. Sit esse nisi eligendi fuga! Quas nisi repellat adipisci animi repellendus incidunt laborum sunt qui nesciunt, ducimus saepe sapiente sed ut labore.



Multiple

Lorem ipsum dolor, sit amet consectetur adipisicing elit. Sit esse nisi eligendi fuga! Quas nisi repellat adipisci animi repellendus incidunt laborum sunt qui nesciunt, ducimus saepe sapiente sed ut labore. Lorem ipsum dolor, sit amet consectetur adipisicing elit. Sit esse nisi eligendi fuga! Quas nisi repellat adipisci animi repellendus incidunt laborum sunt qui nesciunt, ducimus saepe sapiente sed ut labore.



Open State

Each Item id added to the Accordion value array will be open by default.

useState Hook

const [value, setValue] = useState(['club']);
<Accordion value={value} onValueChange={setValue}>
...
</Accordion>

Harcoded

<Accordion value={['club']}>...</Accordion>

Multiple Items

Use multiple to enable multiple items to be opened at once.

<Accordion multiple>...</Accordion>

Custom Icons

import { Plus, Minus, Heart } from 'lucide-react';
<Accordion iconOpen={<Plus size={24} />} iconClosed={<Minus size={24} />}>
...
</Accordion>
<Accordion.Control lead={<Heart size={24} />}>Heart</Accordion.Control>

API Reference

Accordion

Property Type Description
animDuration
number
The slide animation duration as a float value (ex: 0.2).
iconOpen
Set the open state icon.
iconClosed
Set the closed state icon.
onValueChange
Set the opened state.
base
string
Sets base styles.
padding
string
Set padding styles.
spaceY
string
Set vertical spacing styles.
rounded
string
Set border radius styles.
width
string
Set the width styles.
classes
string
Provide arbitrary CSS classes.
ids
The ids of the elements in the accordion. Useful for composition.
multiple
Whether multple accordion items can be expanded at the same time.
Default: false
collapsible
Whether an accordion item can be closed after it has been expanded.
Default: false
value
The `value` of the accordion items that are currently being expanded.
disabled
Whether the accordion items are disabled
onFocusChange
The callback fired when the focused accordion item changes.
dir
The document's text/writing direction.
Default: "ltr"
getRootNode
A root node to correctly resolve document in custom environments. E.x.: Iframes, Electron.

AccordionItem

Property Type Description
base
string
Sets base styles.
spaceY
string
Set vertical spacing styles.
classes
string
Provide arbitrary CSS classes.
value *
string
The value of the accordion item.
disabled
Whether the accordion item is disabled.

AccordionControl

Property Type Description
headingElement
The heading element.
disabled
Set a disabled state for the item.
base
string
Sets control's base styles.
hover
string
Sets control's the hover styles.
padding
string
Sets control's the padding styles.
rounded
string
Sets control's the border radius styles.
classes
string
Provide arbitrary CSS classes to the control.
leadBase
string
Sets the lead's base styles
leadClasses
string
Provide arbitrary CSS classes to the lead.
contentBase
string
Sets the lead's base styles
contentClasses
string
Provide arbitrary CSS classes to the content.
indicatorBase
string
Sets the lead's base styles
indicatorClasses
string
Provide arbitrary CSS classes to the indicator.
lead
The lead child slot for the control.

AccordionPanel

Property Type Description
base
string
Set the panel's base styles.
padding
string
Set the panel's padding styles.
rounded
string
Set the panel's border-radius styles.
classes
string
Provide arbitrary CSS classes to the panel.