Skip to Content
zjkm-ui
Components

Accordion

Sections that open and close smoothly.

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
<Accordion items={faq} />

Installation

npx shadcn@latest add https://ui.zjkm.tech/r/accordion.json
import { Accordion } from "@/components/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

Sections that open and close. It's built on native <details>, so it works before JavaScript loads, every section is keyboard-reachable, and the browser's find-in-page opens the section with the match. Opening animates smoothly in browsers that can animate to height: auto; elsewhere sections open at once.

import { Accordion } from "@/components/accordion";

export function Faq() {
  return <Accordion items={[{ title: "Is there a free plan?", content: "Yes." }]} />;
}

Props

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

With reduced motion, sections open at once.

On this page