Fold Panel
React Native (Expo)
A React Native accordion whose panels grow to the measured height of their content, with a turning chevron and screen reader state.
An accordion whose panels grow to exactly the height of their content, measured rather than guessed, so any content works. The chevron turns as a panel opens, and every header is a button that tells screen readers whether it is expanded. Closed panels are hidden from them. Built for React Native and Expo with react-native only; this page previews it in the browser through react-native-web.
Installation
CLI
npx @modus-ui/cli add fold-panelManual
- Copy the code from the component tab.
- Create a file at
components/ui/fold-panel.tsx. - Paste the code.
It needs no packages beyond react-native, which your Expo or React Native app already has.
Usage
tsx
Props
| Prop | Type | Default | Description |
|---|---|---|---|
items | FoldPanelItem[] | - | The panels. Each has an id, a title and its content. |
multiple | boolean | false | Whether several panels can be open at once. When false, opening one closes the others. |
defaultOpen | string[] | [] | Ids of the panels that start open. |
colors | Partial<FoldPanelColors> | - | Overrides surface, text, mutedText and border. |
style | StyleProp<ViewStyle> | - | Style for the panel container. |
Comments