Chewypixel component
Collapsible
A section that opens and closes by animating its height.
Installation
npx shadcn@latest add https://chewypixel.io/r/collapsible.jsonUsage
import { Button } from "@/components/ui/button";
import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "@/components/ui/collapsible";
export function OrderDetails() {
return (
<Collapsible>
<CollapsibleTrigger asChild>
<Button variant="ghost">Show order details</Button>
</CollapsibleTrigger>
<CollapsibleContent>
<p className="pt-2 text-sm">2 bags of gumdrops and a box of taffy.</p>
</CollapsibleContent>
</Collapsible>
);
}Props
openWhether it's open, when controlled.
boolean
defaultOpenWhether it starts open, when uncontrolled.
boolean = false
onOpenChangeCalled when it opens or closes.
(open: boolean) => void
Released under the MIT License.
More components
- Image LightboxA thumbnail that flies out to a larger view in the middle of the screen, over a lightly blurred page.
- Segmented ControlMutually exclusive options with a highlight that slides to the selected one.
- TabsUnderline tabs. The underline slides to the active tab and resizes to fit its label.
- SwitchA switch whose thumb springs across when toggled and stretches while pressed.
See them in a real app
These components come from Mochi, our admin dashboard template built with Next.js, shadcn/ui and Motion.