This documentation is available as Markdown for AI agents and LLMs. See the full Markdown index or append .md to any documentation URL.
Collapsible
可点击的带标签标题,用于切换其内容的可见性
Android
iOS
Web
Included in Expo Go
Collapsible 是一种基本组件,点击带标签的标题即可显示或隐藏其内容。通过 isOpen 和 onOpenChange 控制 — 每个 Collapsible 都管理独立的状态。


安装
Terminal
If you are installing this in an existing React Native app, make sure to install expo in your project.
用法
基本的可折叠区域
CollapsibleExample.tsx
手风琴(一次展开一个区域)
将每个 Collapsible 的 isOpen 连接到共享的父级值。该组件不会强制互斥 — 如何组合由使用者决定。
CollapsibleAccordionExample.tsx
API
import { Collapsible } from '@expo/ui';
Component
Type: React.Element<CollapsibleProps>
A primitive that toggles visibility of its content via a labelled tappable
header. Controlled via isOpen + onOpenChange.
Props for the Collapsible component, a primitive that
shows or hides its content with a tap on a labelled header.
Optional • Type:
{
color: string,
fontFamily: string,
fontSize: number,
fontWeight: 'normal' | 'bold' | '100' | '200' | '300' | '400' | '500' | '600' | '700' | '800' | '900',
letterSpacing: number,
lineHeight: number,
textAlign: 'center' | 'left' | 'right'
}Text-specific styling for the tappable header label.