Skip to content

Spring Accordion

Numbered panels open with a soft expansion and a rotating circular control.

LIVE PREVIEWInteract with the component
Just React. No extra dependencies.

Copy the component and its CSS module into your project.

CSS Modules

Usage

Matches your current playground settings.

jsx
import SpringAccordion from "./SpringAccordion";
export default function Example() {
return (
<SpringAccordion
items={[
{
"id": "idea",
"title": "Start with a feeling.",
"content": "Collect a colour, a texture, a fragment of type. Give the idea somewhere to begin."
},
{
"id": "shape",
"title": "Find its shape.",
"content": "Make a few studies. Keep the parts that feel right and leave room for something unexpected."
},
{
"id": "move",
"title": "Let it move.",
"content": "A little motion gives an interface rhythm. Make every transition earn its place."
}
]}
defaultValue={"idea"}
accentColor={"#c6b1db"}
background={"#1a161e"}
numbered={true}
/>
);
}

Using Spring Accordion

Supply labelled sections through items and use value with onValueChange when a parent controls the open panel.

Use defaultValue for an initial local selection. numbered adds an ordered visual marker when the sections form a sequence.

Props

NameTypeRequiredDefaultDescription
itemsobject[]No[]Array of { id, title, content, disabled? }. Titles and content accept React nodes; use unique stable ids.
valuestring | number | nullNoundefinedControlled open item id; null closes all panels.
defaultValuestring | number | nullNonullInitially open item id when uncontrolled.
onValueChangefunctionNoundefinedCalled with the requested item id, or null when closing.
accentColorstringNo"#d2b4e3"Number, border, and control colour.
backgroundstringNo"#1a161e"Closed panel background.
numberedbooleanNotrueDisplay sequential two-digit item numbers.
classNamestringNo""Additional CSS classes merged with the component styles.
styleCSSPropertiesNoundefinedInline styles for sizing, typography, and visual overrides.

Related components

Pagination Rail

Navigation

A raised selection moves through a compact row of numbered page controls.

Layered chevron tabs create a compact trail with a distinct current page.

Folding Menu

Navigation

Numbered navigation panels unfold beneath a compact, tactile trigger.

Path Stepper

Navigation

Numbered stops connect into a clean vertical route with completed and current states.