All components
Chewypixel component

Collapsible

A section that opens and closes by animating its height.

Installation

npx shadcn@latest add https://chewypixel.io/r/collapsible.json

Usage

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

open

Whether it's open, when controlled.

boolean

defaultOpen

Whether it starts open, when uncontrolled.

boolean = false

onOpenChange

Called when it opens or closes.

(open: boolean) => void

Released under the MIT License.

More components

See them in a real app

These components come from Mochi, our admin dashboard template built with Next.js, shadcn/ui and Motion.