Collapsible
Use Collapsible to reveal one independent group of optional details or advanced settings.
Preview
Additional settings
Toggle a controlled details section without changing the surrounding content.
Loading preview.
Installation
New to this Registry? Complete the base setup before continuing.
npx shadcn@latest add @neumorphism-ui/collapsibleInstall the shared base once, then add components and their dependencies with the CLI.
Usage
Pair CollapsibleTrigger and CollapsibleContent within Collapsible. Use open and onOpenChange when application state needs to follow expansion.
"use client";
import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "@/components/ui/collapsible";
export default function Example() {
return (
<Collapsible>
<CollapsibleTrigger>Advanced settings</CollapsibleTrigger>
<CollapsibleContent><div>Optional project settings go here.</div></CollapsibleContent>
</Collapsible>
);
}API Reference
Reveal or hide one group of optional settings. Name the trigger for its content. Check expansion with Enter and Space.
| Component | Prop | Type | Default | Description |
|---|---|---|---|---|
Collapsible | open / defaultOpen | boolean | — | Set controlled or initial state. |
CollapsibleTrigger | disabled | boolean | — | Disable user interaction. |
CollapsibleContent | keepMounted | boolean | — | Keep the panel mounted while closed. |
Accessibility
- 01
Name the trigger for its content. Check expansion with Enter and Space.
- 02
Preserve labels and visible focus when customizing render or className.