A scroll-driven two-panel layout — a sticky hero sits behind a reveal panel that slides over it, powered entirely by CSS sticky positioning.
Made by raouf.codesOverview
Core Concept
ParallaxRevealSection creates a scroll-driven depth effect using only CSS position: sticky and stacking order, with no JavaScript listeners or runtime measurements. The first <section> (hero backdrop) pins in place as the user scrolls, while the second <section> (reveal panel) rises and overlaps it.
Key Features
- Pure CSS parallax —
stickypositioning and z-index stacking; no scroll listeners, no layout thrash - Intent variants — supports all design-system colors (
neutral,primary,accent,secondary,success,info,warning,error) - Adaptive height — defaults to
100svh(viewport); passclassName="h-full"inside a sized parent to fill it instead - Recursive composition — nested
ParallaxRevealSectioninstances automatically switch toh-auto overflow-visiblevia descendant selectors, so sticky behaviour flows through every level - Lightweight API — no refs, no resize observers, and no layout effect hooks
Anatomy
Installation
Usage
Basic — full viewport
By default the component takes 100svh. No wrapper needed.
Inside a fixed-height parent
Pass className="h-full" so the component fills its parent instead of the viewport.
Composition — recursive nesting
Nested instances automatically drop overflow and height constraints, so sticky positioning continues to work at every level.
API Reference
ParallaxRevealSection
| Prop | Type | Default |
|---|---|---|
intent? | enum | "neutral" |
shape? | enum | "rounded" |
hero? | ReactNode | - |
...props? | React.ComponentPropsWithRef<"article"> | - |
Accessibility
- Landmark — Renders as semantic
<article>with a clear two-section reading order - Data slots —
data-slotattributes on every section (parallax-reveal-section,parallax-reveal-hero,parallax-reveal-content) for styling hooks and testing - Reduced motion — The parallax effect is CSS-only (
sticky), so it inheritsprefers-reduced-motionbehaviour from the browser naturally
| Key | Action |
|---|---|
Tab | Moves focus sequentially through interactive children in hero and reveal |
Built by raouf.codes. The source code is available on GitHub.
Last updated: 4/4/2026