logoRuru UI

Accordion

The accordion component is a vertically stacked set of interactive headings that each contain a title, content, or both.

Installation

npx ruru-ui-cli@latest add accordion

Usage

The Accordion component is a vertically stacked set of interactive headings that each contain a title, content, or both.

Core Components

You can use the core components to build your own custom accordion.

Multiple Variants

We provide miltiple variants and themes to choose from. You can customize the accordion to fit your design needs. If you need more customization, you can use the core components to build your own custom accordion.

Customizability

Easily customize the accordion by using the AccordionRoot, AccordionItem, AccordionTrigger, and AccordionContent components. Add custom functionalities and styles with ease.

Remember to use e.stopPropagation() to prevent the event from bubbling up the DOM tree.

Is this accessible?

Is this accessible?

Is this accessible?

Is this accessible?

Imports

We are exporting all the core components of accordion along with the Accordions and Accordion components.

import {
  AccordionRoot,
  AccordionItem,
  AccordionTrigger,
  AccordionContent,
  Accordions,
  Accordion,
} from "ruru-ui/components/accordion";

Props

Accordions

PropDescriptionTypeDefault
typeThe type of accordion."single" | "multiple""single"
collapsibleWhether the accordion is collapsible.booleanfalse
variantThe variant of the accordion."default" | "primary" | "none""default"
themeThe theme of the accordion."default" | "primary" | "secondary" | "tertiary""default"
showCopyButtonWeather to show copy button.booleanfalse
propsOther propstypeof AccordionPrimitive.Root with ref{}
Data AttributeDescriptionValues
[data-orientation]The orientation of the accordion."vertical" | "horizontal"
[data-variant]The variant of the accordion."default" | "primary" | "none"
[data-theme]The theme of the accordion."default" | "primary" | "secondary" | "tertiary"

Accordion

PropDescriptionTypeDefault
idThe id of the accordion.stringundefined
triggerThe trigger of the accordion.ReactNodeundefined
TClassNameThe class name of the trigger.stringundefined
CClassNameThe class name of the content.stringundefined
copyTextCostom text to copy.stringundefined
propsOther propstypeof AccordionPrimitive.Item with ref{}
Data AttributeDescriptionValues
[data-orientation]The orientation of the accordion."vertical" | "horizontal"
[data-variant]The variant of the accordion."default" | "primary" | "none"
[data-theme]The theme of the accordion."default" | "primary" | "secondary" | "tertiary"
[data-state]The state of the accordion."open" | "closed"
[data-disabled]Whether the accordion is disabled.true | false

On this page