Skip to main content

Accordion

Default Accordion

To provide an easy-to-use accordion list where users can expand or collapse multiple items independently. It can optionally show a main title and description above the accordion items and supports flexible styling and icon customization.


Key Components

  • AccordionItem
    Represents each accordion entry with an id, title, and content.

  • ThemedText
    Used for displaying all text content with theming support.

  • TouchableOpacity
    Wraps each accordion header to capture user taps for toggling.

  • Ionicons
    Displays the open/close icons on each accordion header, customizable via props.


User Flow

  1. The component optionally displays a main title and a descriptive desc at the top.
  2. Each accordion item is rendered with a clickable header showing its title and an icon indicating expanded/collapsed state.
  3. When the user taps an accordion header:
    • If the item was closed, it opens (content becomes visible).
    • If the item was open, it closes (content hidden).
  4. Multiple items can be open simultaneously by default but can be controlled via the openItems prop.
  5. Accordion styles (bordered or not) and icons are customizable.

Props

PropTypeDefaultDescription
dataAccordionItem[]requiredArray of accordion items to render.
titlestring-Optional main title shown above all accordion items.
descstring-Optional description shown below the main title.
openIconstring'chevron-up'Icon name for expanded state (Ionicons).
closeIconstring'chevron-down'Icon name for collapsed state (Ionicons).
shouldShowIconbooleantrueWhether to show the expand/collapse icon.
openItems`(stringnumber)[]`[0]
isBorderedbooleanfalseWhether accordion items have a bordered card style.

Animated Accordion

A reusable animated accordion UI component for React Native that displays collapsible sections with titles and content. It supports multiple open items, animated transitions, customizable icons, optional borders, and a smooth user experience.


Purpose

To provide an expandable and collapsible list of items with animated transitions. This component supports multiple open sections simultaneously, optional heading and description, and configurable icons for open/close states.


AccordionItem

Represents a single accordion section.

FieldTypeDescription
idstring | numberUnique identifier for the item.
titlestringTitle displayed on the accordion header.
contentstringContent revealed when expanded.

Props

Prop NameTypeDefaultDescription
dataAccordionItem[]RequiredList of items to display in the accordion.
titlestring-Main heading displayed above the accordion list.
descstring-Description displayed under the main title.
openIconstring'chevron-up'Icon when the section is expanded.
closeIconstring'chevron-down'Icon when the section is collapsed.
shouldShowIconbooleantrueWhether to show toggle icons in headers.
openItemsnumber[][0]List of initially expanded item IDs.
isBorderedbooleanfalseWhether each section should have a bordered style.

Example Usage

NOTE: All example can be founded in accordions.tsx