Fidely UI v1 beta is now available!. 🚀

Accordion

A collapsible component for displaying content in a vertical stack.

Usage

import { Accordion } from '@fidely-ui/react'
<Accordion.Root>
  <Accordion.Item>
    <Accordion.ItemTrigger>
      <Accordion.ItemIndicator />
    </Accordion.ItemTrigger>
    <Accordion.ItemContent>
      <Accordion.ItemBody />
    </Accordion.ItemContent>
  </Accordion.Item>
</Accordion.Root>

Default Value

Set the defaultValue prop to specify which item should be expanded by default.

React is a JavaScript library for building user interfaces.

Collapsible

Use the collapsible prop to allow users to close all accordion items.

React is a JavaScript library for building user interfaces.

Multiple Panels

Use the multiple prop to enable expanding multiple panels at the same time.

Size

Use the size prop to adjust the overall size of the accordion. Available sizes: sm, md, lg.

sm

md

lg

Variants

Use the variant prop to switch between different visual styles of the accordion.

subtle

outline

flush

Props

Root

PropTypeDefaultDescription
defaultValuestring[]The value(s) of the item(s) to expand by default.
valuestring[]The controlled value of the expanded item(s).
onValueChange(value: string | string[]) => voidCallback function triggered when the value changes.
collapsiblebooleanfalseAllows all items to be collapsed so none are open.
multiplebooleanfalseEnables multiple accordion items to be open at once.
size"sm" | "md" | "lg""md"Controls the overall size of the accordion.
variant"flush" | "outline" | "subtle""plain"Sets the visual style of the accordion.
childrenReactNodeThe accordion items to render within the root.

Item

PropTypeDefaultDescription
valuestringUnique value used to identify the accordion item.
disabledbooleanfalseDisables interaction for this accordion item.
childrenReactNodeThe trigger and content for the accordion item.

ItemTrigger

PropTypeDefaultDescription
childrenReactNodeThe content displayed inside the trigger button.
disabledbooleanfalseDisables interaction with the trigger.

ItemIndicator

PropTypeDefaultDescription
childrenReactNodeTypicallyi an icon or symbol indicating open/close state.

ItemContent

PropTypeDefaultDescription
childrenReactNodeThe contentt displayed when the accordion item is expanded.

On this page