Skip to main content

Accordion

Collapsible sections. Single or multiple open, controlled or uncontrolled.

Usage

import {Accordion} from 'rn-inkpad';

<Accordion
items={[
{title: 'Shipping', content: 'Free over $50.'},
{title: 'Returns', content: <ReturnsPolicy />},
]}
defaultExpanded={[0]}
/>

// controlled, several open at once
<Accordion items={items} multiple expanded={open} onChange={setOpen} />

Props

NameTypeDefaultDescription
items{title: string; content: ReactNode; icon?: IconProp; disabled?: boolean}[]Sections. String content is wrapped in a Text.
multiplebooleanfalseAllow several open sections.
defaultExpandednumber[][]Initially open indexes (uncontrolled).
expandednumber[]Open indexes (controlled).
onChange(expanded: number[]) => voidCalled with the new open indexes.
expandIconIconPropchevron downIcon of closed sections.
collapseIconIconPropchevron upIcon of open sections.
colorstringtheme textTitle and icon color.
borderColorstringtheme borderBorder color.
styleStyleProp<ViewStyle>Container style.
titleStyleStyleProp<TextStyle>Title style.
contentStyleStyleProp<ViewStyle>Content wrapper style.