Skip to Content
zjkm-ui
Components

Exclusive Accordion

An accordion where opening one closes the others.

Is there a free plan?
Yes. Every free component installs with the shadcn CLI and stays free.
Can I use it in client work?
Yes, in any product, personal or commercial. You just can't resell the components themselves.
Does it work without Tailwind?
Yes. Each component carries its own CSS.
Props
<ExclusiveAccordion items={faq} />

Installation

npx shadcn@latest add https://ui.zjkm.tech/r/exclusive-accordion.json
import { ExclusiveAccordion } from "@/components/exclusive-accordion"

Using JavaScript? Set tsx: false in components.json and the CLI converts it.

New to shadcn? Run npx shadcn@latest init first. The CLI needs components.json and the @/ import alias.

Usage

An accordion where opening one section closes the others. It uses the browser's own grouping for <details>, with a small script for browsers that don't support it yet. Opening animates smoothly in browsers that can animate to height: auto; elsewhere sections open at once.

import { ExclusiveAccordion } from "@/components/exclusive-accordion";

export function Steps() {
  return <ExclusiveAccordion items={steps} defaultOpen={0} />;
}

Props

PropTypeDefaultDescription
items{ title: string; content: ReactNode }[]The sections.
defaultOpennumberIndex open at the start.
classNamestringClasses for the wrapper.

With reduced motion, sections open at once.

On this page