# Collapsible A container that can be expanded or collapsed to show or hide content. ```tsx import { Collapsible } from '@skeletonlabs/skeleton-react'; export default function Default() { return ( Toggle Lorem ipsum dolor sit amet consectetur, adipisicing elit. Velit pariatur error soluta voluptate, accusantium modi repudiandae omnis eligendi, suscipit repellat impedit architecto neque sequi mollitia autem dicta quae ipsum et? ); } ``` ## Controlled ```tsx import { Collapsible } from '@skeletonlabs/skeleton-react'; import { useState } from 'react'; export default function Controlled() { const [open, setOpen] = useState(false); return ( setOpen(details.open)}> {open ? 'Close' : 'Open'} Lorem ipsum dolor sit amet consectetur, adipisicing elit. Velit pariatur error soluta voluptate, accusantium modi repudiandae omnis eligendi, suscipit repellat impedit architecto neque sequi mollitia autem dicta quae ipsum et? ); } ``` ## Indicator ```tsx import { Collapsible } from '@skeletonlabs/skeleton-react'; import { MinusIcon, PlusIcon } from 'lucide-react'; export default function Default() { return ( Toggle Lorem ipsum, dolor sit amet consectetur adipisicing elit. Numquam assumenda veritatis modi repellendus enim accusantium inventore architecto maxime voluptates quibusdam velit perferendis mollitia, quas, aliquam sapiente adipisci illo nostrum vitae? ); } ``` ## Disabled ```tsx import { Collapsible } from '@skeletonlabs/skeleton-react'; export default function Disabled() { return ( Toggle Lorem ipsum, dolor sit amet consectetur adipisicing elit. Quas maxime in praesentium reiciendis eveniet modi mollitia? Odio accusantium veritatis accusamus quia placeat sapiente reiciendis? Consectetur, quis! Voluptatem omnis accusantium blanditiis. ); } ``` ## Alignment ```tsx import { Collapsible } from '@skeletonlabs/skeleton-react'; export default function Alignment() { return ( Toggle Lorem ipsum dolor sit amet consectetur, adipisicing elit. Velit pariatur error soluta voluptate, accusantium modi repudiandae omnis eligendi, suscipit repellat impedit architecto neque sequi mollitia autem dicta quae ipsum et? ); } ``` ## API Reference ### CollapsibleRootProps | Property | Default | Type | Description | | ---------------- | ------- | --------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- | | ids? | - | Partial\<\{ root: string; content: string; trigger: string; }> \| undefined | The ids of the elements in the collapsible. Useful for composition. | | open? | - | boolean \| undefined | The controlled open state of the collapsible. | | defaultOpen? | - | boolean \| undefined | The initial open state of the collapsible when rendered. Use when you don't need to control the open state of the collapsible. | | onOpenChange? | - | ((details: OpenChangeDetails) => void) \| undefined | The callback invoked when the open state changes. | | onExitComplete? | - | VoidFunction \| undefined | The callback invoked when the exit animation completes. | | disabled? | - | boolean \| undefined | Whether the collapsible is disabled. | | collapsedHeight? | - | string \| number \| undefined | The height of the content when collapsed. | | collapsedWidth? | - | string \| number \| undefined | The width of the content when collapsed. | | getRootNode? | - | (() => ShadowRoot \| Node \| Document) \| undefined | A root node to correctly resolve document in custom environments. E.x.: Iframes, Electron. | | dir? | "ltr" | "ltr" \| "rtl" \| undefined | The document's text/writing direction. | | element? | - | ((attributes: HTMLAttributes\<"div">) => Element) \| undefined | Render the element yourself | ### CollapsibleRootProviderProps | Property | Default | Type | Description | | -------- | ------- | -------------------------------------------------------------- | --------------------------- | | value | - | CollapsibleApi\ | - | | element? | - | ((attributes: HTMLAttributes\<"div">) => Element) \| undefined | Render the element yourself | ### CollapsibleRootContextProps | Property | Default | Type | Description | | -------- | ------- | ------------------------------------------------------ | ----------- | | children | - | (collapsible: CollapsibleApi\) => ReactNode | - | ### CollapsibleTriggerProps | Property | Default | Type | Description | | -------- | ------- | ----------------------------------------------------------------- | --------------------------- | | element? | - | ((attributes: HTMLAttributes\<"button">) => Element) \| undefined | Render the element yourself | ### CollapsibleIndicatorProps | Property | Default | Type | Description | | -------- | ------- | -------------------------------------------------------------- | --------------------------- | | element? | - | ((attributes: HTMLAttributes\<"div">) => Element) \| undefined | Render the element yourself | ### CollapsibleContentProps | Property | Default | Type | Description | | -------- | ------- | -------------------------------------------------------------- | --------------------------- | | element? | - | ((attributes: HTMLAttributes\<"div">) => Element) \| undefined | Render the element yourself |