Skip to content
VenusUI
Get started

Smooth Accordion

An accordion whose panels open with a smooth height animation, no measuring needed.

Preview

Installation

npx shadcn@latest add @venusui/accordion-smooth

Run this in a project set up with shadcn. If you haven’t set it up yet, run npx shadcn@latest init first.

Files added to your project

Paths use the default shadcn aliases. The CLI follows the aliases in your components.json.

  • @/components/ui/accordion-smooth.tsx

Usage

The code behind the preview above.

accordion-smooth-demo.tsx

import { AccordionSmooth } from "@/components/ui/accordion-smooth"

export default function AccordionSmoothDemo() {
  return (
    <AccordionSmooth
      className="max-w-md"
      defaultOpen={["install"]}
      items={[
        { id: "install", title: "How do I install a component?", content: "Run the install command shown on its page. The shadcn CLI adds the files for you." },
        { id: "license", title: "Can I use it in client work?", content: "Yes. Free components are MIT licensed." },
        { id: "update", title: "How do I update a component?", content: "Re-run the install command with --overwrite after committing your changes." },
      ]}
    />
  )
}

API reference

PropTypeDefaultDescription
items{ id: string; title: ReactNode; content: ReactNode }[]—Sections. Required.
multiplebooleanfalseAllow several sections open at once.
defaultOpenstring[][]Section ids open at first.
classNamestring—Classes for the wrapper.

Only the props above.

Requirements

  • lucide-react, React 19 and Tailwind CSS v4.

Customization

  • Heights animate with a CSS grid-rows transition, so content of any height works.
  • Headers are h3; change the level to fit your page outline.

Accessibility

  • Headers are buttons with aria-expanded and aria-controls; panels are labelled regions.
  • Closed panels are inert, so their links can’t be focused. Opens instantly with reduced motion.

Troubleshooting

Animation is choppy in older browsers.
Animating grid-template-rows needs a current browser; older ones open instantly instead.
Unknown registry "@venusui"
Your shadcn CLI couldn’t find the namespace in the shadcn registry index. Use the latest CLI (npx shadcn@latest), install by URL, or register it with its address: npx shadcn@latest registry add @venusui=https://venusui.com/r/{name}.json.
No components.json found
Run npx shadcn@latest init in your project first.
Loading preview

A card that tilts in 3D toward the pointer with spring physics.

Loading preview

Camera Shutter

Interactive

A lens with a working iris: blades close to the chosen aperture and snap shut when you release the shutter.

Loading preview

Stacked cards with the next ones peeking out; Next sends the top card to the back.