Accordion Smooth Height
A single-open accordion that animates to its content's natural height while the chevron turns and the answer settles in from a blur.
accordionheightdisclosurefaqkeyboard
Installation
Run the shadcn CLI in a project with Tailwind CSS. The component lands in components/pixelpapa/accordion-smooth-height.tsx.
$pnpm dlx shadcn@latest add "https://pixelpapa.com/r/accordion-smooth-height.json"Manual install+
1. Install the dependencies.
$pnpm add lucide-react motion2. Copy the code from the Code tab above into your project. It imports the cn helper from @/lib/utils, which every shadcn project already has.
Build it with AI
Prefer to let an agent do the wiring? Copy this prompt, describe where the component should go, and paste.
AI prompt
Paste into Claude, Cursor, v0 or Lovable
Add the "Accordion Smooth Height" component from PixelPapa UI to this project. What it is: A single-open accordion that animates to its content's natural height while the chevron turns and the answer settles in from a blur. Category: Accordions. Depends on: lucide-react, motion. 1. Install it with the shadcn CLI: npx shadcn@latest add "https://pixelpapa.com/r/accordion-smooth-height.json" (If the CLI is unavailable, fetch that URL, write files[0].content to components/pixelpapa/accordion-smooth-height.tsx and install the listed dependencies.) 2. Import it from "@/components/pixelpapa/accordion-smooth-height" and place it where I describe below. 3. Keep its animation timings and accessibility attributes. Replace the demo copy and data with content that fits my product, and use my existing theme tokens (bg-background, text-foreground, bg-primary, border-border) rather than hard-coded colours. Where to use it: <describe the page and position here>
More accordions
- Accordion Horizontal PanelsSide-by-side panels where the chosen one springs wide to reveal its story while the others fold down to a vertical title.
- Accordion Nested TreeA nested tree with indent guides where branches unfold with animated height and staggered children, fully navigable with the arrow keys.
- Accordion Numbered EditorialA magazine-style accordion with oversized serif numerals, a rule that draws across the open row and a plus that folds into a minus.
- Accordion With Icons CardsSeparate accordion cards with icon tiles; the open card lifts on a spring, its icon fills with colour and the plus turns into a close mark.