WebberUI

Era Strata Layout

An accordion layout that stacks eras or phases into horizontal strata — the expanded band opens vertically while the rest compress, and the content inside floats up with parallax.

This is a WebberUI Pro component

Free during the launch campaign: sign up or sign in, then hit “Copy install command” in the preview above and it installs straight away — no payment, no credit card. The command below returns 401 while you are signed out.

How to install Pro components →See the plans →

Loading preview…
npx shadcn@latest add "https://webberui.com/r/era-strata-layout.json?t=<install token>"

Playground

Tune the props live — the code snippet updates as you go, so you can dial in the look you want before copying it.

440
72
<EraStrataLayout />

Installation

npx shadcn@latest add "https://webberui.com/r/era-strata-layout.json?t=<install token>"

Or, once registries are configured in components.json, install it as @webberui/era-strata-layout.

Usage

import {
  EraStrataLayout,
  type EraStratumData,
} from "@/components/ui/era-strata-layout";

const eras: EraStratumData[] = [
  {
    id: "1998",
    era: "1998",
    title: "Founded in a garage",
    summary: "Three people and one server.",
    content: "The first version shipped late at night.",
    accentClassName: "bg-amber-400 dark:bg-amber-500",
  },
  // ...
];

<EraStrataLayout items={eras} height={440} defaultActive={0} />;

trigger switches how expansion is triggered: click (the default), hover to expand on hover, or scroll to advance stratum by stratum as the page scrolls.

// Advance on scroll: when scrolling inside a nested container, pass that container's ref to container
<EraStrataLayout items={eras} trigger="scroll" height={480} />

Props

PropTypeDefaultDescription
itemsEraStratumData[]Strata data, stacked top to bottom in order
activenumberControlled expanded index (applies in click / hover modes)
defaultActivenumber0Initial expanded index in uncontrolled mode
onActiveChange(index: number) => voidFires when the expanded index changes
trigger"click" | "hover" | "scroll""click"How expansion is triggered
heightnumber | string440Total layout height (a number means px)
collapsedSizenumber72Height of a collapsed stratum / title bar (px)
parallaxbooleantrueWhether the content floats up with parallax
containerRefObject<HTMLElement | null>Nested scroll container ref for scroll mode
labelstring"年代地層"Accessible label
classNamestringClass on the outer container
stratumClassNamestringClass applied to each stratum band

EraStratumData

FieldTypeDescription
idstringStable identifier, used as the accessibility anchor and the key
eraReactNodeEra / phase marker, still visible when collapsed
titleReactNodeSection title, still visible when collapsed
summaryReactNodeThe one-line summary that floats up first on expand
contentReactNodeThe main content that floats up with parallax on expand
accentClassNamestringAccent color class for the stratum color bar on the left

How it works

  • The expanded stratum opens vertically on a spring transition while the rest compress back to collapsedSize in sync, leaving only their title bars visible
  • Remaining space is distributed with flexbox flex-grow, and exactly one stratum is expanded at a time; make sure heightcollapsedSize × number of strata
  • Inside a stratum, summary and content float up in sequence from different starting offsets to create parallax layering; with parallax={false} only the fade in remains
  • scroll mode extends the matching scroll height and pins to the viewport, mapping scroll progress onto the expanded stratum; clicking a stratum smoothly scrolls to it

Accessibility

  • Each stratum title is a native button with aria-expanded and aria-controls, and the content area is a role="region" labeled by its title through aria-labelledby
  • The title bars use a roving tabindex: after Tab moves in, / (or / ) move between strata, Home / End jump to the first and last, and Enter / Space expand
  • Collapsed content areas are marked inert and aria-hidden, so neither the keyboard nor assistive technology wanders into them
  • When the user has "reduce motion" enabled at the system level, it becomes a fully expanded static list showing all the content at once, with no compression and no animation

On this page