Skip to content
caliper ui docs

Components

Accordion

A stack of headings that each reveal their content, one open at a time.

Free
pnpm dlx shadcn@latest add @caliper/accordion

Handoff · Harbour redesign

From Mara Chen to Noor Haddad · due 24 Oct

The booking flow, the six room pages and the arrival email. Pricing stays as it is until January.

Designs in Harbour / v3, copy in the Room pages doc, and the build on staging under the harbour-v3 branch.

Mara reviews copy; Noor reviews the build; Ivo signs off anything that touches payments.
Installs components/ui/accordion.tsxDepends on lucide-reactMotion none in component source

When to use

Use it for

  • FAQs and handoff notes where people scan headings first.
  • Long content that is read selectively.

Skip it when

  • Everything should be visible at once; use sections.
  • A single disclosure; use a collapsible.

Installation

terminal
pnpm dlx shadcn@latest add @caliper/accordion

Adds its 2 files to components/ui/, each with its own stylesheet, and installs their packages. No account needed. The first part also adds Caliper UI’s tokens; import them once as in Installation.

Usage

This is the code behind the preview above.

example.tsx
import { useState, type ReactNode } from "react"
import { Accordion } from "@/components/ui/accordion"
import { cn } from "@/components/ui/lib/cn"

function Panel({ title, context, media, action, className, children }: { title: string; context: string; media?: ReactNode; action?: ReactNode; className?: string; children?: ReactNode }) {
  return (
    <section className={cn("grid w-full max-w-md gap-5 rounded-overlay border border-border bg-background p-6 shadow-resting", className)}>
      <div className="flex items-center gap-3">
        {media}
        <div className="grid min-w-0 flex-1 gap-1">
          <p className="font-medium">{title}</p>
          <p className="text-sm text-muted-foreground">{context}</p>
        </div>
        {action}
      </div>
      {children}
    </section>
  );
}

export function HandoffAccordion() {
  const [open, setOpen] = useState<string | null>("scope");
  return (
    <Panel title="Handoff · Harbour redesign" context="From Mara Chen to Noor Haddad · due 24 Oct">
      <Accordion
        value={open}
        onValueChange={setOpen}
        items={[
          { id: "scope", title: "What is in scope", content: "The booking flow, the six room pages and the arrival email. Pricing stays as it is until January." },
          { id: "files", title: "Where the files are", content: "Designs in Harbour / v3, copy in the Room pages doc, and the build on staging under the harbour-v3 branch." },
          { id: "owner", title: "Who to ask", content: "Mara reviews copy; Noor reviews the build; Ivo signs off anything that touches payments." },
        ]}
      />
    </Panel>
  );
}

API reference

Accordion

component
PropTypeDefault
items *readonly AccordionItem[]—
valuestring | null—
defaultValuestring | nullnull
onValueChange((value: string | null) => void)—
classNamestring—

Accessibility

It exposes region semantics, with aria-expanded, aria-controls, aria-hidden and aria-labelledby kept in step with state.

No custom key handling; Tab and the native activation keys do the work.

Motion

It declares no animation in its component source. Any transition comes from its stylesheet, which uses the duration tokens that collapse to instant under prefers-reduced-motion.

All Disclosure examples