BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/godui/container-scroll

Container Scroll

godui/container-scroll
FreeComponent

A device frame that un-tilts from a 3D perspective and scales to rest as you scroll — the classic product hero.

Install it

npx shadcn@latest add https://godui.design/r/container-scroll.json

Source

packages/components/src/container-scroll/container-scroll.tsxgodui.design/r/container-scroll.json
1"use client";
2
3import {
4 motion,
5 useReducedMotion,
6 useScroll,
7 useSpring,
8 useTransform,
9} from "framer-motion";
10import * as React from "react";
11
12export type ContainerScrollProps = React.HTMLAttributes<HTMLDivElement> & {
13 /** Headline block rendered above the device, rising as you scroll. */
14 header?: React.ReactNode;
15 /** The "screen" content — an image, video, or live UI. */
16 children: React.ReactNode;
17};
18
19// SPRING.smooth — surfaces / shared-layout feel.
20const SPRING = { stiffness: 320, damping: 32, mass: 0.9 } as const;
21
22const ContainerScroll = React.forwardRef<HTMLDivElement, ContainerScrollProps>(
23 ({ header, children, className, ...props }, ref) => {
24 const reduce = useReducedMotion();
25 const containerRef = React.useRef<HTMLDivElement>(null);
26 React.useImperativeHandle(
27 ref,
28 () => containerRef.current as HTMLDivElement,
29 );
30
31 const { scrollYProgress } = useScroll({ target: containerRef });
32
33 const rotateX = useSpring(
34 useTransform(scrollYProgress, [0, 1], [20, 0]),
35 SPRING,
36 );
37 const scale = useSpring(
38 useTransform(scrollYProgress, [0, 1], [1.05, 1]),
39 SPRING,
40 );
41 const translateY = useSpring(
42 useTransform(scrollYProgress, [0, 1], [0, -100]),
43 SPRING,
44 );
45
46 const frame = (
47 <div className="mx-auto w-full max-w-5xl rounded-2xl border border-border bg-card p-2 shadow-2xl md:p-3">
48 <div className="aspect-[16/10] size-full overflow-hidden rounded-xl bg-muted [&>img]:size-full [&>img]:object-cover [&>video]:size-full [&>video]:object-cover">
49 {children}
50 </div>
51 </div>
52 );
53
54 // Reduced motion: a calm, upright device with no scroll-driven transforms.
55 if (reduce) {
56 return (
57 <div
58 ref={containerRef}
59 data-slot="container-scroll"
60 className={`flex flex-col items-center px-4 py-16 ${className ?? ""}`}
61 {...props}
62 >
63 {header ? <div className="mb-10 text-center">{header}</div> : null}
64 {frame}
65 </div>
66 );
67 }
68
69 return (
70 <div
71 ref={containerRef}
72 data-slot="container-scroll"
73 className={`relative flex h-[60rem] items-center justify-center p-4 md:h-[80rem] md:p-20 ${className ?? ""}`}
74 {...props}
75 >
76 <div className="relative w-full [perspective:1000px]">
77 {header ? (
78 <motion.div
79 style={{ translateY }}
80// … truncated

What it pulls in

npm packages

  • framer-motion

Other registry items

  • @godui/godui-theme

Files it writes

  • packages/components/src/container-scroll/container-scroll.tsx

Facts

Registry
godui
Type
registry:ui
Access
Free
Files written
1
Licence
MIT
First indexed
2026-08-03
Last confirmed
yesterday

Go to the source

godui.design LucasBassetti/godui on GitHub Raw registry item This item as JSON

More from godui

All 105 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
AccordionaccordiongoduiComponentsFree1 dep
Agent Flowagent-flowgoduiComponentsFree1 dep
Agent Timelineagent-timelinegoduiComponentsFree1 dep
Animated Beamanimated-beamgoduiComponentsFree1 dep
Animated Testimonialsanimated-testimonialsgoduiComponentsFree1 dep
Animated Tooltipanimated-tooltipgoduiComponentsFree1 dep
App Showcaseapp-showcasegoduiComponentsFree1 dep
Aurora Textaurora-textgoduiComponentsFreeno deps
BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex

BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex

BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex