Motion UIComponentsComponent

Parallax layers

Scroll-linked depth layers that move at different speeds as the page scrolls.

npx shadcn@latest add @motion/parallax-layers

API reference

Components

<ParallaxScene />

Scroll-driving scene root that publishes progress to layers.

children?

ReactNode

Scene contents: ParallaxLayers and static chrome.

className?

string

Merged onto the scene element.

as?

ElementType = "div"

Element type for the scene root. Default "div".

offset?

UseScrollOptions["offset"] = DEFAULT_OFFSET

Scroll offset defining 0 → 1 progress.

<ParallaxLayer />

Single depth layer that moves with scroll progress.

children?

ReactNode

Layer content.

speed

number

Scroll speed multiplier.

scaleDrift?

number = 0

Scale drift from 1 to 1 + scaleDrift * speed. Default 0.

className?

string

Merged onto the moving element.

"aria-hidden"?

boolean

Set on purely decorative layers.

Hooks

useParallaxScroll

Raw scrollYProgress from the enclosing ParallaxScene.

useParallaxScroll(): MotionValue<number>