Scroll Reveal Content A
abui/scroll-reveal-content-aFreeBlock
A block that shows 3 parts of content with a specific image for each part, and a fancy line grow expand during scroll.
Live preview
live · rendered by the registry
Rendered by abui on their own page — this is the component running, not a screenshot of it.Install it
npx shadcn@latest add https://abui.io/r/scroll-reveal-content-a.jsonSource
1"use client"23import React from "react"4import { useRef } from "react"5import { cn } from "@/lib/utils"6import Image from "next/image"7import { useMotionValueEvent, useScroll } from "motion/react"89export const centralColumnStyle = "w-[90%] max-w-[1340px] mx-auto"10export const pageYPadding = "py-10 md:py-12 lg:py-20 xl:py-30 2xl:py-40"11const defaultTitleClass = "text-2xl md:text-3xl font-semibold mb-2 text-foreground"12const defaultDescriptionClass = "text-base md:text-lg font-medium mb-2 text-foreground max-w-[400px] leading-[130%]"13const imageClass =14 "absolute top-0 right-0 ml-auto w-auto h-full object-cover rounded-2xl transition-opacity duration-300"1516export interface ItemContent {17 title: string18 description: string19 image: {20 url: string21 width: number22 height: number23 alt: string24 }25}2627interface Props extends React.ComponentProps<"div"> {28 contentA: ItemContent29 contentB: ItemContent30 contentC: ItemContent31 titleClass?: string32 descriptionClass?: string33}3435const ScrollRevealContentA = ({36 contentA,37 contentB,38 contentC,39 titleClass = defaultTitleClass,40 descriptionClass = defaultDescriptionClass,41 className,42 ...props43}: Props) => {44 const [scrollProgress, setScrollProgress] = React.useState(0)45 const ref0 = useRef(null)4647 const { scrollYProgress } = useScroll({48 target: ref0,49 })50 useMotionValueEvent(scrollYProgress, "change", () => {51 // @ts-ignore52 setScrollProgress(scrollYProgress.current)53 })5455 return (56 <div className={cn("bg-background", className)} ref={ref0} {...props}>57 <div className="max-w-[90vw] mx-auto">58 <div className="flex w-full mx-auto relative z-20">59 <div60 className={cn(centralColumnStyle, "sticky top-0 flex flex-col w-full items-start justify-center h-[100vh]")}61 >62 <div className="flex flex-row gap-16 md:gap-24 lg:gap-32 xl:gap-40 2xl:gap-48 w-full h-full">63 <div className="lg:!w-[50vw] !w-full h-auto flex flex-col justify-center gap-10 md:gap-auto">64 <PointItem65 active={true}66 number="01"67 title={contentA.title}68 description={contentA.description}69 thresholdStart={0}70 thresholdEnd={0.33}71 scrollProgress={scrollProgress}72 />73 <PointItem74 active={true}75 number="02"76 title={contentB.title}77// … truncated
What it pulls in
npm packages
Files it writes
More from abui
All 20 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Animated Chartanimated-chart | abui | Blocks | Free | 1 dep | |
| Availabilityavailability | abui | Blocks | Free | 1 dep | |
| Calendar Yearcalendar-year | abui | Blocks | Free | 1 dep | |
| Timelinetimeline | abui | Blocks | Free | 3 deps |
