Skip to content
synccn

Accordion

Expanding sections with smooth height animation.

Yes. The CLI copies each component's source into your project, so you can edit it like any other file.

They use the right ARIA roles, support the keyboard and keep visible focus. Test them in your own flows too.

Every colour and radius comes from CSS variables. Build a theme on the Themes page and paste the result into your CSS.

Installation

$ pnpm dlx shadcn@latest add @synccn/accordion

First time in this project? Connect synccn with one command.

Usage

import { Accordion } from "@/components/ui/accordion";<Accordion items={faq} type="single" />

API reference

Generated from the component's TypeScript types, so it always matches the code.

Accordion

items: [{ value, title, content }] type "single" keeps one panel open; "multiple" allows many.

  • itemsrequired
    AccordionItem[]

    Sections to render, in order.

  • type
    "single" | "multiple"

    Default "single"

    Whether one or several sections can be open at once.

  • defaultValue
    string[]

    Default []

    Values of the sections open on first render.

  • collapsible
    boolean

    Default true

    In "single" mode, whether the open section can be closed again.

  • className
    string

    Extra classes for the root element.

Dependencies

Read from the component's imports when the site builds. The CLI installs all of these for you.

Helpers

npm packages

Keyboard

  • TabMove between section headers
  • EnterorSpaceOpen or close the focused section

Accessibility

  • Headers are buttons with aria-expanded and aria-controls; each panel is a region labelled by its header.

From the source

Read from this component's code when the site builds, so it can't drift.

  • ARIA roles: region
  • ARIA attributes: aria-controls, aria-expanded, aria-labelledby
  • Shows a visible focus ring for keyboard users