Introduction
Components
- Accordion
- Action Sheet
- Alert
- Audio Player
- Audio Recorder
- Audio Waveform
- Avatar
- AvoidKeyboard
- Badge
- BottomSheet
- Button
- Camera
- Camera Preview
- Card
- Carousel
- Checkbox
- Collapsible
- Color Picker
- Combobox
- Date Picker
- File Picker
- Gallery
- Hello Wave
- Icon
- Image
- Input
- Input OTP
- Link
- MediaPicker
- Mode Toggle
- Onboarding
- ParallaxScrollView
- Picker
- Popover
- Progress
- Radio
- ScrollView
- SearchBar
- Separator
- Share
- Sheet
- Skeleton
- Spinner
- Switch
- Table
- Tabs
- Text
- Toast
- Toggle
- Video
- View
Charts
Installation
pnpm dlx bna-ui add collapsible
Usage
import { Collapsible } from '@/components/ui/collapsible';
<Collapsible title='What is React Native?'>
<Text>
React Native is an open-source UI software framework created by Meta. It is
used to develop applications for multiple platforms.
</Text>
</Collapsible>
Examples
Default
Multiple Collapsibles
Nested Collapsibles
With Interactive Content
FAQ Style
API Reference
Collapsible
An expandable/collapsible container component that shows or hides its content.
Prop | Type | Default | Description |
---|---|---|---|
title | string | - | The title text displayed in the header. |
children | ReactNode | - | The content to show/hide when toggled. |
Component Structure
The Collapsible component consists of:
- Header: A touchable area containing the title and chevron icon
- Content: The collapsible content that shows/hides based on state
- Icon: A chevron that rotates to indicate open/closed state
Behavior
- Initially collapsed by default
- Clicking the header toggles the collapsed/expanded state
- Smooth rotation animation for the chevron icon
- Content appears with proper indentation when expanded
- Each collapsible manages its own state independently
Accessibility
The Collapsible component is built with accessibility in mind:
- Uses TouchableOpacity for proper touch handling
- Visual indicator (chevron) shows current state
- Proper spacing and indentation for content hierarchy
- Supports nested content and interactive elements
- Clear visual feedback with activeOpacity on touch
Styling
The component uses:
- Flexible layout with proper spacing
- Icon rotation animation for visual feedback
- Consistent indentation for nested content
- Theme-aware text styling through the Text component
- Responsive touch areas for better usability
Use Cases
Perfect for:
- FAQ sections
- Settings panels
- Navigation menus
- Content organization
- Progressive disclosure
- Help documentation
- Feature explanations