Skip to content

Expanding Panels

A row of panels that opens around the selected item.

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 ExpandingPanels from "./ExpandingPanels";
export default function Example() {
return (
<ExpandingPanels
items={[
{
"id": "dune",
"title": "Dune",
"description": "Contours of a quieter landscape.",
"background": "linear-gradient(155deg, #b48c68 15%, #e0bc96 40%, #85563f 41%, #ae7d53 65%, #473026 66%)"
},
{
"id": "tide",
"title": "Tide",
"description": "Follow a different current.",
"background": "repeating-radial-gradient(ellipse at 20% 100%, #193b49 0%, #62898c 9%, #214957 12%, #183642 20%)"
},
{
"id": "bloom",
"title": "Bloom",
"description": "An unexpected point of view.",
"background": "radial-gradient(ellipse at 70% 20%, #e49aaf, transparent 50%), radial-gradient(ellipse at 0% 80%, #a94462, transparent 60%), #43233c"
}
]}
height={380}
gap={10}
borderRadius={18}
expandRatio={5}
/>
);
}

Using Expanding Panels

Use items for a concise set of visual destinations. Keep captions brief enough to remain useful in both narrow and expanded panels.

Pair activeIndex with onActiveChange for external selection, and use onSelect for the action taken on a panel. height and expandRatio control the composition.

Props

NameTypeRequiredDefaultDescription
itemsobject[]No[]Array of { id, title, description?, image?, background? }. Images are optional; backgrounds accept CSS values. Empty arrays render nothing.
activeIndexnumberNoundefinedOptional controlled selected index.
defaultActiveIndexnumberNo0Initial selected index when uncontrolled.
onActiveChangefunctionNoundefinedCalled with the next index on pointer or keyboard selection.
onSelectfunctionNoundefinedCalled with (item, index) when a panel is clicked or activated with Enter/Space.
heightnumber | stringNo380Panel row height, in pixels or a CSS length.
gapnumberNo10Space between panels in pixels.
borderRadiusnumberNo18Panel corner radius in pixels.
expandRationumberNo5Flex growth of the active panel relative to its neighbours.
classNamestringNo""Additional CSS classes, merged with the component styles.
styleCSSPropertiesNoundefinedInline styles for caller-defined sizing and visual overrides.
labelstringNo"Expandable panels"Accessible group label.

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.