crucıble

Fold

A neutral-elegant FAQ accordion of soft stacked cards: the open row lifts a hair off the stack, its chevron spins up in one accent hue, and the answer unfolds by hinging down from the top edge over a measured height animation. Full disclosure semantics with aria-expanded/aria-controls, labelled region panels, and Up/Down/Home/End focus movement; single-open by default with a singleOpen knob; instant open/close with the open row resting lifted under reduced motion.

motionfree

Installation

CLI

npx shadcn@latest add @crucible/fold

Manual — install dependencies, then copy the source

npm install motion

Props

PropTypeDefaultDescription
itemsFoldItem[]five generic FAQsQuestion/answer pairs, rendered in order.
headingReact.ReactNode"Frequently asked questions"Optional heading rendered as an h2 above the stack. Pass null to omit.
singleOpenbooleantrueWhen true (default), opening a row folds the previously open one shut so only one answer shows at a time. When false, rows open independently.
defaultOpenIndexnumber0Index open on mount. Pass -1 to start fully folded.
colorsFoldColors{ accent: "#93c5fd" }Accent tokens — the single cool hue on the active chevron and ring.
Also accepts all props of Omit<React.ComponentPropsWithoutRef<"section">, "color">they pass through to the underlying element.

Honors prefers-reduced-motion with a designed static fallback, and passes className through.