Skip to main content
Version: 1.0.3

Accordion

A vertically stacked set of interactive headings that each reveal a section of content.

Installation

ignix add component accordion

Usage

Import the components:

import * as React from 'react';
import { Accordion, AccordionItem, AccordionTrigger, AccordionContent } from '@ignix-ui/accordion';

Basic Example

export function AccordionDemo() {
return (
<Accordion type="single" collapsible className="w-full">
<AccordionItem value="item-1">
<AccordionTrigger>Is it accessible?</AccordionTrigger>
<AccordionContent>
Yes. It adheres to the WAI-ARIA design pattern.
</AccordionContent>
</AccordionItem>
</Accordion>
)
}

Props

Accordion

The root component that contains all the accordion items.

PropTypeDefaultDescription
type"single" | "multiple"-Determines whether one or multiple items can be opened at the same time.
valuestring | string[]-The controlled value of the item(s) to expand.
defaultValuestring | string[]-The value of the item(s) to expand by default when initially rendered.
onValueChange(value: string | string[]) => void-Event handler called when the expanded state of an item changes.
collapsiblebooleanfalseWhen type is "single", allows all items to be closed.
disabledbooleanfalseWhen true, prevents the user from interacting with the accordion and all its items.
dir"ltr" | "rtl""ltr"The reading direction of the accordion.
orientation"vertical" | "horizontal""vertical"The orientation of the accordion.

AccordionItem

Contains all the parts of a single accordion item.

PropTypeDefaultDescription
valuestring-A unique value for the item.
disabledbooleanfalseWhen true, prevents the user from interacting with the item.
classNamestring-Additional CSS classes for the item.

AccordionTrigger

Toggles the collapsed state of an item.

PropTypeDefaultDescription
classNamestring-Additional CSS classes for the trigger.
childrenReact.ReactNode-The content of the trigger.

AccordionContent

Contains the content of an accordion item that is revealed when the item is expanded.

PropTypeDefaultDescription
variantAnimationVariants"fade"The animation variant applied when the content is revealed.
classNamestring-Additional CSS classes for the content container.
childrenReact.ReactNode-The content to be displayed.