WebberUI

Container Scroll 3d

A container that rotates in 3D as you scroll to reveal its content, flattening out from a tilted-back angle to push the view right up to the viewer.

As the page scrolls, the container flattens out from a tilted-back perspective to face the viewer — a good fit for revealing a product screen, dashboard, or chart in a hero or feature section. useScroll binds to the element's travel through the viewport, so the flattening, scaling, and shadow are all driven by scroll progress.

Loading preview…
npx shadcn@latest add https://webberui.com/r/container-scroll-3d.json

Playground

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

22
1.05
40
1000
<ContainerScroll3d />

Installation

npx shadcn@latest add https://webberui.com/r/container-scroll-3d.json

Or, once registries are configured in components.json, install it as @webberui/container-scroll-3d.

Usage

import { ContainerScroll3d } from "@/components/ui/container-scroll-3d";

<ContainerScroll3d title={<h2 className="text-3xl font-bold">Scroll to reveal</h2>}>
  <img src="/dashboard.png" alt="Dashboard" className="w-full" />
</ContainerScroll3d>;

children is the content revealed once the card flattens out, and it can be any JSX: a screenshot, a video, a chart, or a live component. title is optional and rises slightly while fading in as you scroll.

Props

PropTypeDefaultDescription
titleReact.ReactNodeTitle above the card; rises and fades in with the scroll
childrenReact.ReactNodeThe content revealed inside the card
rotatenumber22Initial backward tilt angle (deg); reaches zero and flattens mid-way
scaleFromnumber1.05Initial scale, converging to 1 once flattened
titleTranslatenumber40Distance the title rises (px)
perspectivenumber10003D perspective depth (px); smaller values exaggerate the perspective
containerReact.RefObjectRef of the nested scroll container; the window is the scroll container by default
classNamestringStyling for the outer container
cardClassNamestringStyling for the card frame

Accessibility

  • When the user has "reduce motion" enabled at the system level, the card is presented flat and static with no scroll transforms applied
  • useScroll binds to the element's travel through the viewport, so computation stops once it leaves the viewport and no extra resources are consumed

On this page