Component / Layout

Scroll Reveal

Reveal content inside the page or a bounded scroller without global scroll handlers. Server markup remains visible, dimensions stay stable, and observation is progressive.

0 / 3 observed
Preset
Bounded viewport / scroll to reveal
Scroll specimen

Move through the viewport

Each card begins visible in server markup and enhances only after hydration.

01

Observe locally

A bounded IntersectionObserver watches this scroll pane, not the page.

02

Reveal without shift

Opacity and transforms preserve layout dimensions during every reveal.

03

Remain available

Server-rendered content stays readable when JavaScript or observation is unavailable.

End of bounded viewport

Delivery contract

Install it

pnpm add easecraft@0.1.0

The component imports stable APIs from easecraft.

Files / 00

    Dependencies / 03

    easecraft
    npm / 0.1.0
    react
    peer / >=18.2.0 <20.0.0
    react-dom
    peer / >=18.2.0 <20.0.0

    Package usage

    Use it

    import { ScrollReveal } from "easecraft";
    
    <ScrollReveal
      preset="fade-rise"
      threshold={0.2}
      rootMargin="0px 0px -10% 0px"
    >
      <ProjectCard />
    </ScrollReveal>

    Typed contract

    API

    PropTypeDefaultPurpose
    childrenReactNoderequiredContent available before enhancement
    asHTML tag"div"Polymorphic semantic host
    observerRootElement | Document | nullviewportBounded observer root
    thresholdnumber | readonly number[]0.15Visible ratio required
    rootMarginstring"0px 0px -10% 0px"Observer boundary adjustment
    oncebooleantrueDisconnect after first completed reveal
    preset"fade" | "rise" | "fade-rise""fade-rise"Reveal treatment
    durationduration token | number"normal"Reveal duration
    distancedistance token | number"medium"Reveal travel
    delaynumber0Delay before reveal
    easingeasing token | string"enter"Reveal easing
    onReveal() => voidnoneCompleted reveal callback
    onVisibilityChange(visible) => voidnoneRepeat-mode visibility callback

    Release requirement

    Accessibility

    Progressive enhancement
    Content is visible in SSR markup and remains available without JavaScript.
    No layout shift
    Only opacity, visibility, and transforms change during observation.
    Bounded observation
    IntersectionObserver supports page and local scrolling roots without polling.
    Reduced motion
    Content remains immediately visible and no observer or animation is created.