Accordion

Collapsible sections with single or multiple selection.

Collapsible sections for FAQs, settings groups and anything that would otherwise need a long scroll. Expansion animates with a Reanimated layout transition, and the content unmounts when collapsed.

Installation

Accordion ships with the library — no separate install.

import { Accordion } from 'panelui-native';

Usage

<Accordion selectionMode="single" defaultValue="shipping">
  <Accordion.Item value="shipping">
    <Accordion.Trigger>
      <Accordion.Title>How long does shipping take?</Accordion.Title>
      <Accordion.Indicator />
    </Accordion.Trigger>
    <Accordion.Content>
      Standard delivery arrives in three to five working days.
    </Accordion.Content>
  </Accordion.Item>
</Accordion>

Composition

<Accordion>
  <Accordion.Item value="…">
    <Accordion.Trigger>
      <Accordion.Title>…</Accordion.Title>
      <Accordion.Indicator />
    </Accordion.Trigger>
    <Accordion.Content>…</Accordion.Content>
  </Accordion.Item>
</Accordion>
  • Accordion.Item — One collapsible section. Its value identifies it in the accordion's state.
  • Accordion.Trigger — The pressable header row. A bare string child is wrapped in the title style.
  • Accordion.Title — Heading text inside the trigger.
  • Accordion.Indicator — Chevron that rotates 180° while the item is open.
  • Accordion.Content — The collapsible body. Unmounts when closed.

Variants

variant

  • default (default)
  • surface
  • separated
  • bordered
  • ghost

API Reference

Accordion

PropTypeDefaultDescription
classNamestring
variantAccordionVariantdefault
selectionModeAccordionSelectionModesingle collapses the open item when another opens.
valuestring | string[]Expanded item value(s), controlled.
defaultValuestring | string[]
onValueChange(value: string | string[]) => void
hideSeparatorbooleanHide the hairlines drawn between items.

Accordion.Item

PropTypeDefaultDescription
classNamestring
valuestringIdentifies this item in the accordion's value.
isDisabledboolean

Accordion.Trigger

PropTypeDefaultDescription
classNamestring

Accordion.Indicator

PropTypeDefaultDescription
classNamestring

Accordion.Content

PropTypeDefaultDescription
classNamestring

Every part also accepts the underlying React Native props (ViewProps or TextProps) and a className for Tailwind utilities.

Notes

Pass an array to value / defaultValue with selectionMode="multiple". onValueChange hands back whatever shape you gave it — a string in single mode, an array in multiple.

On this page