--- title: Collapsible description: An interactive component which expands/collapses a panel. base: aria component: true featured: true links: doc: https://react-aria.adobe.com/Disclosure api: https://react-aria.adobe.com/Disclosure#api --- ## Installation Command Manual ```bash npx shadcn@latest add collapsible ``` Install the following dependencies: ```bash npm install react-aria-components ``` Copy and paste the following code into your project. Update the import paths to match your project setup. ## Usage ```tsx showLineNumbers import { Collapsible, CollapsibleContent, CollapsibleTrigger, } from "@/components/ui/collapsible" ``` ```tsx showLineNumbers Can I use this in my project? Yes. Free to use for personal and commercial projects. No attribution required. ``` ## Composition Use the following composition to build a `Collapsible`: ```text Collapsible ├── CollapsibleTrigger └── CollapsibleContent ``` ## Controlled State Use the `isExpanded` and `onExpandedChange` props to control the state. ```tsx showLineNumbers import * as React from "react" export function Example() { const [open, setOpen] = React.useState(false) return ( Toggle Content ) } ``` ## Basic ## Settings Panel Use a trigger button to reveal additional settings. ## File Tree Use nested collapsibles to build a file tree. ## RTL To enable RTL support in shadcn/ui, see the [RTL configuration guide](/docs/rtl). ## API Reference See the [React Aria](https://react-aria.adobe.com/Disclosure#api) documentation for more information.