Accordion
A vertically stacked set of interactive headings that each reveal an associated section of content.
The Accordion component is a vertically stacked set of collapsible sections. It supports single and multiple expanded items, animated open/close transitions using React Native Reanimated, and is fully customizable with NativeWind classes.
Preview
Installation
The Accordion component is part of the novaui-components package. Make sure you have the required peer dependencies installed:
npx novaui-cli add accordionDependencies
The Accordion requires the following peer dependencies:
react-native-reanimated>= 3lucide-react-native>= 0.300
Import
import { Accordion, AccordionItem, AccordionTrigger, AccordionContent } from 'novaui-components'Basic Usage
The Accordion is a compound component consisting of four parts:
Accordion- The root containerAccordionItem- An individual collapsible sectionAccordionTrigger- The clickable header that toggles the contentAccordionContent- The collapsible body content
import { Accordion, AccordionItem, AccordionTrigger, AccordionContent } from 'novaui-components'
export function BasicAccordion() {
return (
<Accordion type="single" collapsible defaultValue="item-1">
<AccordionItem value="item-1">
<AccordionTrigger>Is it accessible?</AccordionTrigger>
<AccordionContent>
<Text>Yes. It adheres to the WAI-ARIA design pattern and supports keyboard navigation.</Text>
</AccordionContent>
</AccordionItem>
<AccordionItem value="item-2">
<AccordionTrigger>Is it styled?</AccordionTrigger>
<AccordionContent>
<Text>Yes. It comes with default styles using NativeWind that match your theme.</Text>
</AccordionContent>
</AccordionItem>
</Accordion>
)
}Single Mode
By default, only one item can be expanded at a time. When a new item is opened, the previously open item closes:
<Accordion type="single" collapsible defaultValue="item-1">
<AccordionItem value="item-1">
<AccordionTrigger>Section One</AccordionTrigger>
<AccordionContent>
<Text>Only one section is open at a time in single mode.</Text>
</AccordionContent>
</AccordionItem>
<AccordionItem value="item-2">
<AccordionTrigger>Section Two</AccordionTrigger>
<AccordionContent>
<Text>Opening this will close the other section.</Text>
</AccordionContent>
</AccordionItem>
</Accordion>Multiple Mode
Allow multiple items to be expanded simultaneously:
<Accordion type="multiple" defaultValue={["item-1", "item-2"]}>
<AccordionItem value="item-1">
<AccordionTrigger>Section One</AccordionTrigger>
<AccordionContent>
<Text>This section is expanded.</Text>
</AccordionContent>
</AccordionItem>
<AccordionItem value="item-2">
<AccordionTrigger>Section Two</AccordionTrigger>
<AccordionContent>
<Text>This section is also expanded at the same time.</Text>
</AccordionContent>
</AccordionItem>
<AccordionItem value="item-3">
<AccordionTrigger>Section Three</AccordionTrigger>
<AccordionContent>
<Text>Each section can be toggled independently.</Text>
</AccordionContent>
</AccordionItem>
</Accordion>Collapsible
When collapsible is true (default), clicking an open item in single mode will close it. Set it to false to keep one item always open:
<Accordion type="single" collapsible={false} defaultValue="item-1">
<AccordionItem value="item-1">
<AccordionTrigger>Always One Open</AccordionTrigger>
<AccordionContent>
<Text>This item cannot be collapsed — one item is always open.</Text>
</AccordionContent>
</AccordionItem>
<AccordionItem value="item-2">
<AccordionTrigger>Another Item</AccordionTrigger>
<AccordionContent>
<Text>Clicking this will close the other item.</Text>
</AccordionContent>
</AccordionItem>
</Accordion>Advanced Examples
FAQ Section
Build an FAQ section with the Accordion:
import { Accordion, AccordionItem, AccordionTrigger, AccordionContent } from 'novaui-components'
import { Text } from 'react-native'
export function FAQ() {
return (
<Accordion type="single" collapsible defaultValue="faq-1">
<AccordionItem value="faq-1">
<AccordionTrigger>What is NovaUI?</AccordionTrigger>
<AccordionContent>
<Text>NovaUI is a React Native UI component library built on NativeWind with 50+ customizable components.</Text>
</AccordionContent>
</AccordionItem>
<AccordionItem value="faq-2">
<AccordionTrigger>Is it free to use?</AccordionTrigger>
<AccordionContent>
<Text>Yes, NovaUI is open source and free to use in any project.</Text>
</AccordionContent>
</AccordionItem>
<AccordionItem value="faq-3">
<AccordionTrigger>Can I customize the components?</AccordionTrigger>
<AccordionContent>
<Text>Absolutely! Components are copied into your project — you own the code and can modify anything.</Text>
</AccordionContent>
</AccordionItem>
</Accordion>
)
}Props API
Accordion Props
Extends React.ComponentPropsWithoutRef<typeof View> and includes:
| Prop | Type | Default | Description |
|---|---|---|---|
type | 'single' | 'multiple' | 'single' | Whether one or multiple items can be expanded at once |
collapsible | boolean | true | Whether the open item can be collapsed in single mode |
defaultValue | string | string[] | - | The initially expanded item(s) |
onValueChange | (value: string | string[]) => void | - | Callback when the expanded state changes |
className | string | - | Additional CSS classes for the container |
AccordionItem Props
Extends React.ComponentPropsWithoutRef<typeof View> and includes:
| Prop | Type | Default | Description |
|---|---|---|---|
value | string | required | A unique identifier for this accordion item |
className | string | - | Additional CSS classes for the item |
AccordionTrigger Props
Extends React.ComponentPropsWithoutRef<typeof Pressable>:
| Prop | Type | Default | Description |
|---|---|---|---|
children | React.ReactNode | string | - | Trigger content. Strings are auto-wrapped in styled Text |
className | string | - | Additional CSS classes for the trigger |
AccordionContent Props
Extends React.ComponentPropsWithoutRef<typeof View>:
| Prop | Type | Default | Description |
|---|---|---|---|
children | React.ReactNode | - | The collapsible content |
className | string | - | Additional CSS classes for the content wrapper |
Animation
The Accordion uses react-native-reanimated for smooth open/close animations:
- Chevron rotation: The chevron icon rotates 180 degrees when expanded
- Height animation: Content height animates smoothly from 0 to full height
- Opacity: Content fades in/out during the transition
Accessibility
The Accordion component is built with accessibility in mind:
- Uses
Pressablefor proper touch handling - Supports keyboard navigation on web
- Each trigger is focusable and activatable via tap or keyboard
Best Practices
-
Use meaningful headings: Each trigger should clearly describe the content it reveals
-
Keep content concise: Accordion content should be scannable and not overly long
-
Choose the right type: Use
singlefor FAQs or settings,multiplefor checklists or filters -
Default expanded: Consider setting
defaultValuefor the most important item so users see content immediately -
Collapsible behavior: Keep
collapsible={true}(default) to let users close all items if needed
Related Components
- Use with
Textfor content insideAccordionContent - Combine with
Cardfor grouped accordion sections - Works well inside
ScrollAreafor long lists