Accordion

A vertically stacked set of interactive headings that each reveal an associated section of content.
Access to Fuegokit npm packages, source code repositories, and some content is limited to Appfire staff. Log in with Slack to continue.

Import

import { Accordion } from "@fuegokit/react";

Usage

Yes. It adheres to the WAI-ARIA design pattern.

<Accordion>
<Accordion.Item>
<Accordion.Header>
<Accordion.Trigger />
</Accordion.Header>
<Accordion.Content />
</Accordion.Item>
</Accordion>

Props

Accordion

A vertically stacked set of interactive headings that each reveal an associated section of content.
NameTypeDefaultDescription
asChild
boolean
falseChange the default rendered element for the one passed as a child, merging their props and behavior.
type*
'single' | 'multiple'
-The controlled open state of the dialog. Must be used in conjunction with `onOpenChange`.
value
string
-The controlled value of the item to expand when type is 'single'. Must be used in conjunction with `onValueChange`.
defaultValue
string
-The value of the item to expand when initially rendered and type is 'single'. Use when you do not need to control the state of the items.
onValueChange
boolean
(value: string) => voidEvent handler called when the expanded state of an item changes and type is 'single'.
value
string[]
-The controlled value of the item to expand when type is 'multiple'. Must be used in conjunction with onValueChange.
defaultValue
string[]
[]The value of the item to expand when initially rendered and type is 'single'. Use when you do not need to control the state of the items.
onValueChange
(value: string[]) => void
-Event handler called when the expanded state of an item changes and type is 'multiple'.
collapsible
boolean
falseWhen type is 'single', allows closing content when clicking trigger for an open item.
disabled
boolean
falseWhen `true`, prevents the user from interacting with the accordion and all its items.
dir
'ltr' | 'rtl'
'ltr'When `true`, prevents the user from interacting with the accordion and all its items.
orientation
'horizontal' | 'vertical'
'vertical'The orientation of the accordion.
Data attributes
Data attributeValues
[data-orientation]
'vertical' | 'horizontal'

Accordion.Item

Contains all the parts of a collapsible section.
NameTypeDefaultDescription
asChild
boolean
falseChange the default rendered element for the one passed as a child, merging their props and behavior.
disabled
boolean
falseWhen `true`, prevents the user from interacting with the item.
value*
string
-A unique value for the item.
Data attributes
Data attributeValues
[data-state]
'open' | 'closed'
[data-disabled]
Present when disabled
[data-orientation]
'vertical' | 'horizontal'

Accordion.Header

Wraps an `Accordion.Trigger`. Use the `asChild` prop to update it to the appropriate heading level for your page.
NameTypeDefaultDescription
asChild
boolean
falseChange the default rendered element for the one passed as a child, merging their props and behavior.
Data attributes
Data attributeValues
[data-state]
'open' | 'closed'
[data-disabled]
Present when disabled
[data-orientation]
'vertical' | 'horizontal'

Accordion.Trigger

Toggles the collapsed state of its associated item. It should be nested inside of an `Accordion.Header`.
NameTypeDefaultDescription
asChild
boolean
falseChange the default rendered element for the one passed as a child, merging their props and behavior.
Data attributes
Data attributeValues
[data-state]
'open' | 'closed'
[data-disabled]
Present when disabled
[data-orientation]
'vertical' | 'horizontal'

Accordion.Content

Contains the collapsible content for an item.
NameTypeDefaultDescription
asChild
boolean
falseChange the default rendered element for the one passed as a child, merging their props and behavior.
forceMount
boolean
-Used to force mounting when more control is needed. Useful when controlling animation with React animation libraries.
Data attributes
Data attributeValues
[data-state]
'open' | 'closed'
[data-disabled]
Present when disabled
[data-orientation]
'vertical' | 'horizontal'