Components

Accordion

Collapsible content sections with animated expand/collapse transitions.

iOSAndroid
Preview Accordion on your device

Scan with Expo Go

Download Expo Go, then scan the QR code to preview native components.

Installation

pnpm dlx @docyrus/cli add @docyrus/rn-accordion
Required Packages(1 package)
pnpm add react-native-reanimated

Usage

import {
  AccordionRoot,
  AccordionItem,
  AccordionTrigger,
  AccordionContent
} from '@/components/docyrus-native/accordion';

<AccordionRoot type="single" collapsible>
  <AccordionItem value="item-1">
    <AccordionTrigger>Section One</AccordionTrigger>
    <AccordionContent>Content for section one.</AccordionContent>
  </AccordionItem>
  <AccordionItem value="item-2">
    <AccordionTrigger>Section Two</AccordionTrigger>
    <AccordionContent>Content for section two.</AccordionContent>
  </AccordionItem>
</AccordionRoot>

API Reference

AccordionRoot

PropTypeDefaultDescription
type'single' | 'multiple''single'Whether one or multiple items can be open at once
collapsiblebooleantrueWhether open items can be collapsed (single mode only)
valuestring | string[]—Controlled open value(s)
defaultValuestring | string[]—Initial open value(s)
onValueChange(val: string | string[]) => void—Callback when open state changes
size'sm' | 'md' | 'lg''md'Size of trigger and content text
variant'default' | 'outline' | 'filled''default'Visual style variant
chevronPosition'left' | 'right''right'Position of the expand/collapse chevron
spacing'none' | 'sm' | 'md' | 'lg''none'Gap between accordion items
classNamestring—Additional CSS classes
childrenReactNode—AccordionItem children

AccordionItem

PropTypeDefaultDescription
valuestring—Unique identifier for the item
disabledboolean—Whether the item is disabled
classNamestring—Item container CSS classes
childrenReactNode—Trigger and content children

AccordionTrigger

PropTypeDefaultDescription
childrenReactNode—Trigger label (string or custom node)
classNamestring—Trigger CSS classes
textClassNamestring—Text CSS classes

AccordionContent

PropTypeDefaultDescription
childrenReactNode—Content to show when expanded (string or custom node)
classNamestring—Content area CSS classes

Components

ComponentDescription
AccordionRootRoot container managing open state and context
AccordionItemIndividual collapsible item wrapper
AccordionTriggerPressable header that toggles open/close
AccordionContentAnimated content area that expands/collapses

Type Exports

TypeDescription
AccordionRootPropsProps for AccordionRoot component
AccordionItemPropsProps for AccordionItem component
AccordionTriggerPropsProps for AccordionTrigger component
AccordionContentPropsProps for AccordionContent component
AccordionType'single' | 'multiple'
AccordionSize'sm' | 'md' | 'lg'
AccordionVariant'default' | 'outline' | 'filled'

On this page