skip to content
mpkcn

~/components/scroll-hint

Scroll Hint

An animated scroll-down indicator (line, chevron or mouse) that fades out as you scroll and can jump to the next section.

~/hero

scroll this box

$ cd ../next-section

Installation

terminal
npx mpkcn add scroll-hint
deps:framer-motion@13.4.4· tested with react@19.3.0

Usage

Put it at the bottom of your hero. It fades out over the first 80px of scroll.

tsx
import { ScrollHint } from "@/components/mpkcn/scroll-hint";

export function Hero() {
  return (
    <section className="relative h-dvh">
      {/* … */}
      <div className="absolute inset-x-0 bottom-8 flex justify-center">
        <ScrollHint target="#work" />
      </div>
    </section>
  );
}

With target it becomes a link that scrolls to that element and moves focus there. With only onClick it is a button. With neither it is purely decorative and hidden from screen readers.

Examples

Variants

"line" runs a block down a hairline, "chevron" bounces an arrow, "mouse" rolls a wheel. Use the buttons under the first preview to switch.

~/hero

scroll this box

$ cd ../next-section

Inside a scroll container

By default it watches the page. Pass container (a ref) to watch a scrolling element instead, as the previews do.

tsx
const box = useRef<HTMLDivElement>(null);

<div ref={box} className="h-96 overflow-y-auto">
  <ScrollHint container={box} target="#next" scrollBlock="nearest" />
  …
</div>

Props

PropTypeDefaultDescription
labelstring"scroll"Mono text above the indicator. An empty string hides it.
variant"line" | "chevron" | "mouse""line"Shape of the indicator.
targetstring—Selector to scroll to on click, e.g. "#work". Makes it a link.
scrollBlockScrollLogicalPosition"start"How the target lines up after the scroll.
onClick() => void—Called on click. Makes it a button when there is no target.
ariaLabelstring"Scroll down"Accessible name of the link or button.
hideAfternumber | null80Pixels of scroll before it has fully faded. null keeps it visible.
containerRefObject<HTMLElement | null>—Scroll container to watch instead of the page.
ignoreReducedMotionbooleanfalseAnimate even under reduced motion. Only use it behind an explicit action.
classNamestring—Extra classes for the root.

Accessibility

  • As a link or a button it has the name "Scroll down" (change it with ariaLabel) and a visible focus ring. The label and the animation inside it are hidden from screen readers.
  • After the scroll, focus moves to the target (it gets tabindex="-1" if it is not focusable), so keyboard users continue from there.
  • Once it has faded out it ignores the pointer and leaves the tab order.
  • Under prefers-reduced-motion: reduce the indicator holds still and the jump is instant instead of smooth.