Accordion

A React accordion on Base UI for FAQ sections and settings, with single or multiple open items in bordered, separated, minimal, and FAQ styles.

Loading preview

Examples

Practical examples and common states for the same installable component.

Bordered

Enclosed container with item dividers.

examples/accordion-bordered.tsx
import {
Accordion,
AccordionContent,
AccordionItem,
AccordionTrigger,
} from "@/components/wensity/accordion";
export function AccordionBordered() {
return (
<Accordion type="single" variant="bordered" defaultValue="item-1">
<AccordionItem value="item-1">
<AccordionTrigger>What is included in the free plan?</AccordionTrigger>
<AccordionContent>
Every primitive in the library, unlimited projects, and community support.
</AccordionContent>
</AccordionItem>
</Accordion>
);
}

Separated

Individually spaced accordion items.

examples/accordion-separated.tsx
import {
Accordion,
AccordionContent,
AccordionItem,
AccordionTrigger,
} from "@/components/wensity/accordion";
export function AccordionSeparated() {
return (
<Accordion type="single" variant="separated" defaultValue="item-1">
<AccordionItem value="item-1">
<AccordionTrigger>What is included in the free plan?</AccordionTrigger>
<AccordionContent>
Every primitive in the library, unlimited projects, and community support.
</AccordionContent>
</AccordionItem>
</Accordion>
);
}

Card

Wrap the Accordion in a Card component.

Requires: card

examples/accordion-card.tsx
import {
Accordion,
AccordionContent,
AccordionItem,
AccordionTrigger,
} from "@/components/wensity/accordion";
import {
Card,
CardContent,
CardDescription,
CardHeader,
CardTitle,
} from "@/components/wensity/card";
export function AccordionCard() {
return (
<Card className="max-w-md">
<CardHeader>
<CardTitle className="text-lg">Subscription & Billing</CardTitle>
<CardDescription className="text-[14px] leading-5">
Common questions about your account, plans, payments and cancellations.
</CardDescription>
</CardHeader>
<CardContent>
<Accordion type="single">
<AccordionItem value="item-1">
<AccordionTrigger>What subscription plans do you offer?</AccordionTrigger>
<AccordionContent>
We offer Starter, Pro, and Team plans billed monthly or annually.
</AccordionContent>
</AccordionItem>
<AccordionItem value="item-2">
<AccordionTrigger>How does billing work?</AccordionTrigger>
<AccordionContent>
You are billed automatically at the start of each cycle.
</AccordionContent>
</AccordionItem>
<AccordionItem value="item-3">
<AccordionTrigger>How do I cancel my subscription?</AccordionTrigger>
<AccordionContent>
Cancel anytime from your account settings.
</AccordionContent>
</AccordionItem>
</Accordion>
</CardContent>
</Card>
);
}

FAQ

Spacious layout optimized for FAQ sections.

examples/accordion-faq.tsx
import {
Accordion,
AccordionContent,
AccordionItem,
AccordionTrigger,
} from "@/components/wensity/accordion";
export function AccordionFaq() {
return (
<Accordion type="single" variant="faq" defaultValue="item-1">
<AccordionItem value="item-1">
<AccordionTrigger>What is included in the free plan?</AccordionTrigger>
<AccordionContent>
Every primitive in the library, unlimited projects, and community support.
</AccordionContent>
</AccordionItem>
</Accordion>
);
}

Overview

Accordion is a React and Tailwind CSS accordion on Base UI, in Next.js or any React app, for FAQ sections, settings, and long pages. type single keeps one item open at a time and multiple lets several stay open, while collapsible decides whether the open item can be closed again. Bordered, separated, minimal, and FAQ variants change the framing, and the FAQ style uses larger text for marketing pages. Panels stay mounted when closed, so their answers remain in the HTML that search engines read. In single mode onValueChange returns an empty string when everything closes.

Installation

Run the following command

~/your-project
pnpm dlx wensity@latest add accordion

Usage

Import Accordion from @/components/wensity/accordion and render it anywhere in your React or Next.js app. The source lands in your own repo, so every prop, class and animation below is yours to edit.

app/example.tsx
import {
Accordion,
AccordionContent,
AccordionItem,
AccordionTrigger,
} from "@/components/wensity/accordion";
export default function Example() {
return (
<Accordion type="single" defaultValue="item-1">
<AccordionItem value="item-1">
<AccordionTrigger>What is included in the free plan?</AccordionTrigger>
<AccordionContent>
Every primitive in the library, unlimited projects, and community support.
</AccordionContent>
</AccordionItem>
<AccordionItem value="item-2">
<AccordionTrigger>Can I use this commercially?</AccordionTrigger>
<AccordionContent>
Yes. Every primitive is MIT licensed and safe to ship in commercial products.
</AccordionContent>
</AccordionItem>
</Accordion>
);
}

Props

PropTypeDefaultDescription
type"single" | "multiple""single"Whether one item or several may be open at once.
variant"bordered" | "separated" | "minimal" | "faq""minimal"Item treatment. faq is tuned for question and answer lists.
valuestring | string[]-Controlled open item or items.
defaultValuestring | string[]-Initially open items when uncontrolled.
collapsiblebooleantrueWith a single-type accordion, allows closing the open item so none remain open.
onValueChange(value: string | string[]) => void-Called when the open items change.
  • Expanding Cards component preview

    Expanding Cards

    Hover a tall editorial strip and it opens wide, the rest of the row holding as tight vertical slivers of the same image.

  • Multi-Step Form Wizard component preview

    Multi-Step Form Wizard

    A multi-step form wizard whose card physically reshapes to wrap each new step as the content slides in behind it.

  • Scroll Stack component preview

    Scroll Stack

    Cards that pin, tilt, and stack into a tidy deck as you scroll, with zero scroll hijacking anywhere in the sequence.

  • Animated 3D Folder component preview

    Animated 3D Folder

    A real CSS 3D folder that tilts toward your cursor, drops its cover open, and lifts its files into a stepped index.