Accordion

Stacked sections that open from numbered headings, each with a glyph that turns.

Component

Accordion belongs to the Layout group in the CyberSpec catalog. It uses @ui-sdk/react/accordion.

Installation

Use a React 19 project with shadcn configured. Render the installed components inside the Cyber root, and import your global stylesheet in the app entry point.

bunx --bun shadcn@latest add https://www.cyberspec.dev/r/accordion.json

Example

"use client"

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

export default function AccordionDemo() {
  return (
    <>
      <Accordion
        role="group"
        aria-label="Deck details"
        defaultValue={["core"]}
        items={[
          {
            value: "core",
            label: "Core",
            meta: "12 threads",
            content:
              "Vanta Mk.II, second revision. Twelve threads and 64 units of buffer, enough to hold three daemons in memory and still answer a trace.",
          },
          {
            value: "daemons",
            label: "Daemons",
            meta: "3 loaded",
            content:
              "Ghostwrite, Static Bloom and Null Ping are loaded. Deadlock is on the shelf: it needs a slot this deck doesn't have.",
          },
          {
            value: "firmware",
            label: "Firmware",
            meta: "Sealed",
            disabled: true,
            content: "Sealed by Vanta Systems.",
          },
        ]}
      />
    </>
  )
}

Install this example

bunx --bun shadcn@latest add https://www.cyberspec.dev/r/accordion-demo.json

Resources

View as Markdown