Components

Accordion

An animated React accordion built on shadcn/ui and Radix: the drop-in Accordion eases its height open, fades answers in and turns its chevron — plus a spring-physics Motion accordion with a gliding hover highlight, and an SEO-ready FAQ section with a plus-to-minus icon and FAQPage JSON-LD.

  • Drop-in shadcn API
  • Radix Accordion
  • Spring height
  • FAQ schema
  • prefers-reduced-motion

Run the shadcn CLI with the component's registry URL. It copies the source into your project and installs its dependencies.

Motion (formerly Framer Motion). Heights use springs, and content fades in once the panel starts opening.

With prefers-reduced-motion the panels open instantly and nothing slides. Colors still fade, so state changes stay clear.

Yes. Closed panels stay in the DOM (marked inert), so search engines can read every answer.

Installation

$ npx shadcn@latest add https://duskui.com/r/accordion.json

Replaces components/ui/accordion.tsx with the same parts and data-slot attributes. The height animation uses the accordion-down / accordion-up keyframes from tw-animate-css, which shadcn projects already include.

Usage

faq.tsx
import {
  Accordion,
  AccordionContent,
  AccordionItem,
  AccordionTrigger,
} from "@/components/ui/accordion"

export function Faq() {
  return (
    <Accordion type="single" collapsible>
      <AccordionItem value="refunds">
        <AccordionTrigger>Can I get a refund?</AccordionTrigger>
        <AccordionContent>Yes, within 30 days, no questions asked.</AccordionContent>
      </AccordionItem>
    </Accordion>
  )
}

Examples

Default

type="single" with collapsible keeps at most one item open. The answer fades in while the panel grows; closing is quicker than opening.

Yes. It follows the WAI-ARIA accordion pattern, with arrow-key navigation between triggers.

Multiple open

type="multiple" lets several sections stay open — handy for settings and filters. Triggers accept any content, like a leading icon.

Name, avatar and public bio.

Password, passkeys and two-factor authentication.

Blocks

Ready-made variations composed from the base component with Motion. Each installs on its own and pulls in its dependencies automatically.

Motion Accordion

Panels open on a spring and their content fades in. A soft highlight glides between items under the cursor (a shared layoutId) and the open item gets a quiet outline. Closed answers stay in the DOM as inert, so they are still indexed by search engines. value is always an array, in single and multiple mode.

Run the shadcn CLI with the component's registry URL. It copies the source into your project and installs its dependencies.

Motion (formerly Framer Motion). Heights use springs, and content fades in once the panel starts opening.

With prefers-reduced-motion the panels open instantly and nothing slides. Colors still fade, so state changes stay clear.

Yes. Closed panels stay in the DOM (marked inert), so search engines can read every answer.
$ npx shadcn@latest add https://duskui.com/r/motion-accordion.json
PropTypeDefaultDescription
type"single" | "multiple""single"One open item at a time, or any number.
collapsiblebooleantrueSingle mode: allow closing the open item.
value / onValueChangestring[] / (value: string[]) => void—Controlled open items.
defaultValuestring[][]Items open on first render.
disabledbooleanfalseDisable every item.
MotionAccordionItem / Trigger / ContentAccordionItem / AccordionTrigger / Radix Content props—The parts; Content's className styles its inner wrapper.

FAQ Accordion

A data-driven FAQ section: numbered questions, a plus that folds into a minus, and answers that ease open. Set jsonLd to emit schema.org FAQPage structured data for rich results. It has no hooks, so it renders in a Server Component and the JSON-LD lands in the initial HTML.

Yes. Every component is open source and free for personal and commercial projects.

$ npx shadcn@latest add https://duskui.com/r/faq-accordion.json
PropTypeDefaultDescription
items{ question, answer, answerText?, value? }[]—Questions and answers. `answer` can be JSX.
multiplebooleanfalseAllow several answers open at once.
defaultValuestring[]—Open on first render: item values or `item-<index>`.
numberedbooleantruePrefix questions with 01, 02…
jsonLdbooleanfalseRender FAQPage JSON-LD. Uses string answers or `answerText`.

API Reference

Same parts as shadcn/ui: Accordion, AccordionItem, AccordionTrigger and AccordionContent, each forwarding its Radix Accordion props. className on AccordionContent styles the inner padding wrapper, like shadcn.

PropTypeDefaultDescription
type"single" | "multiple"—On Accordion. Required by Radix.
collapsiblebooleanfalseSingle mode: allow closing the open item.
value / defaultValue / onValueChangestring | string[]—Open item(s); an array in multiple mode.
iconReactNode—On AccordionTrigger: replaces the chevron. Style it with group-data-[state=open]/accordion-trigger:.
disabledbooleanfalseOn Accordion or a single AccordionItem.

Accessibility

  • Built on Radix Accordion: each trigger is a button inside a heading with aria-expanded and aria-controls; arrow keys, Home and End move between triggers.
  • Triggers show a focus-visible ring; chevrons and plus / minus icons are aria-hidden.
  • Motion Accordion keeps closed panels mounted but inert, so their links can't be focused and screen readers skip them.
  • Under prefers-reduced-motion panels open and close instantly and the chevron snaps; color changes still fade.