This documentation is available as Markdown for AI agents and LLMs. See the full Markdown index or append .md to any documentation URL.

Collapsible

A labelled tappable header that toggles visibility of its content.

Android
iOS
Web
Included in Expo Go

Collapsible is a primitive that shows or hides its content with a tap on a labelled header. Controlled via isOpen and onOpenChange — each Collapsible manages independent state.

An expanded About section with a chevron and description textAn expanded About section with a chevron and description text

Installation

Terminal
- npx expo install @expo/ui
- yarn expo install @expo/ui
- pnpm expo install @expo/ui
- bun expo install @expo/ui

If you are installing this in an existing React Native app, make sure to install expo in your project.

Usage

Basic collapsible

CollapsibleExample.tsx
import { useState } from 'react'; import { useColorScheme } from 'react-native'; import { Host, Column, Collapsible, Text } from '@expo/ui'; export default function CollapsibleExample() { const [open, setOpen] = useState(false); const colorScheme = useColorScheme(); const ink = { color: colorScheme === 'dark' ? '#FFFFFF' : '#000000' }; return ( <Host matchContents={{ vertical: true }} style={{ width: '100%' }}> <Column spacing={8} style={{ padding: 16 }}> <Collapsible isOpen={open} onOpenChange={setOpen} label="About"> <Text textStyle={ink}> A primitive that toggles visibility of its content via a labelled tappable header. </Text> </Collapsible> </Column> </Host> ); }

Accordion (one section open at a time)

Wire each Collapsible's isOpen to a shared parent value. The component doesn't enforce exclusivity — composition is up to the consumer.

CollapsibleAccordionExample.tsx
import { useState } from 'react'; import { useColorScheme } from 'react-native'; import { Host, Column, Collapsible, Text } from '@expo/ui'; type Section = 'a' | 'b' | 'c' | null; export default function CollapsibleAccordionExample() { const [openSection, setOpenSection] = useState<Section>('a'); const colorScheme = useColorScheme(); const ink = { color: colorScheme === 'dark' ? '#FFFFFF' : '#000000' }; return ( <Host matchContents={{ vertical: true }} style={{ width: '100%' }}> <Column spacing={8} style={{ padding: 16 }}> <Collapsible isOpen={openSection === 'a'} onOpenChange={open => setOpenSection(open ? 'a' : null)} label="Section A"> <Text textStyle={ink}>Opening B or C closes this one.</Text> </Collapsible> <Collapsible isOpen={openSection === 'b'} onOpenChange={open => setOpenSection(open ? 'b' : null)} label="Section B"> <Text textStyle={ink}>Opening A or C closes this one.</Text> </Collapsible> <Collapsible isOpen={openSection === 'c'} onOpenChange={open => setOpenSection(open ? 'c' : null)} label="Section C"> <Text textStyle={ink}>Opening A or B closes this one.</Text> </Collapsible> </Column> </Host> ); }

API

import { Collapsible } from '@expo/ui';

No API data file found, sorry!