1. components
  2. accordion
  3. react

Accordion

Divide content into collapsible sections.




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

Prop Type Description
multiple
boolean Enables opening multiple items at once.
value
array Takes an array list of open items.
animDuration
number The slide animation duration in milliseconds.
iconOpen
React.ReactNode Set the open state icon.
iconClosed
React.ReactNode Set the closed state icon.
onValueChange
object 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.
children
React.ReactNode -

AccordionItem

Prop Type Description
id *
string The unique ID.
base
string Sets base styles.
spaceY
string Set vertical spacing styles.
classes
string Provide arbitrary CSS classes.
onClick
object Triggers on item click.
children
React.ReactNode -

AccordionControl

Prop Type Description
disabled
boolean 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.
iconsBase
string Set the base styles for the state icons.
lead
React.ReactNode The lead child slot for the control.
children
React.ReactNode -

AccordionPanel

Prop 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.
children
React.ReactNode -