Headlines that rise letter by letter, slide up line by line, blur into focus or light up as you scroll.
An editorial headline whose letters start spread wide and draw together into place as it scrolls into view.
Customize
Usage
import { TrackingIn } from "@/components/motionkit/tracking-in";
<TrackingIn
as="h1"
text="Quietly confident"
className="text-7xl font-semibold"
/>Motion
The exact curves this component runs, plotted with Motion's own maths.
Letters draw in
Scrolls into view
Editorial headlines, brand statements, portfolio covers and section titles on minimal, typographic sites.
Motion animates the heading's letter-spacing from wide to its final value as it scrolls into view, alongside a fade and a short blur-to-sharp, with a long ease-out so the letters settle gently. In scroll-linked mode the spacing is a transform of scroll progress instead, so it closes up as you scroll.
Works in the App Router as is. Requires Tailwind CSS v4.
One command adds the file and installs its dependencies. Needs a components.json (run npx shadcn@latest init once if you don't have one).
npx shadcn@latest add https://www.motionkitui.com/r/tracking-in.jsonnpm install motionSave as components/motionkit/tracking-in.tsx.
"use client";
import { useRef } from "react";
import { motion, useReducedMotion, useScroll, useTransform } from "motion/react";
type TrackingInProps = {
text?: string;
/** The element to render, for the right heading level. */
as?: "h1" | "h2" | "h3" | "p";
/** Letter spacing it starts from, in em. */
from?: number;
/** Letter spacing it settles at, in em. */
to?: number;
/** Seconds it takes to settle (when not scroll-linked). */
duration?: number;
/** Tie the spacing to scroll position instead of playing once. */
scrollLinked?: boolean;
className?: string;
};
/**
* An editorial headline whose letters start spread wide and draw together into place as it scrolls into view,
* fading and sharpening as they go. Plays once, or follows the scroll when scroll-linked. With reduced motion it
* appears at its final spacing.
*/
export function TrackingIn({ text = "Quietly confident", as = "h2", from = 0.6, to = -0.02, duration = 1.4, scrollLinked = false, className = "" }: TrackingInProps) {
const reduceMotion = useReducedMotion();
const ref = useRef<HTMLHeadingElement>(null);
const { scrollYProgress } = useScroll({ target: ref, offset: ["start end", "center center"] });
const spacing = useTransform(scrollYProgress, [0, 1], [`${from}em`, `${to}em`]);
const opacity = useTransform(scrollYProgress, [0, 0.6], [0, 1]);
const Tag = motion[as];
if (reduceMotion) {
return (
<Tag ref={ref} className={className} style={{ letterSpacing: `${to}em` }}>
{text}
</Tag>
);
}
if (scrollLinked) {
return (
<Tag ref={ref} className={`whitespace-nowrap ${className}`} style={{ letterSpacing: spacing, opacity }}>
{text}
</Tag>
);
}
return (
<Tag
ref={ref}
className={`whitespace-nowrap ${className}`}
initial={{ letterSpacing: `${from}em`, opacity: 0, filter: "blur(8px)" }}
whileInView={{ letterSpacing: `${to}em`, opacity: 1, filter: "blur(0px)" }}
viewport={{ once: true, amount: 0.8 }}
transition={{ duration, ease: [0.16, 1, 0.3, 1], opacity: { duration: duration * 0.6 }, filter: { duration: duration * 0.7 } }}
>
{text}
</Tag>
);
}
| Prop | Type | Default | Description |
|---|---|---|---|
| text | string | — | The headline. |
| as | "h1" | "h2" | "h3" | "p" | "h2" | The element to render. |
| from | number | 0.6 | Starting letter spacing in em. |
| to | number | -0.02 | Final letter spacing in em. |
| duration | number | 1.4 | Seconds to settle. |
| scrollLinked | boolean | false | Tie the spacing to scroll position. |
How we audit: the WCAG 2.2 animation checklist and respecting reduced motion in React.
Yes. The file starts with "use client", so you can import it straight into a Server Component page or layout. It works in Vite as is, and in Astro as a React island.
Only the motion package, beside React and Tailwind CSS v4. There is no MotionKit package and no Tailwind config to add.
Yes. Run npx shadcn@latest add https://www.motionkitui.com/r/tracking-in.json in any project with a components.json. It saves the file to components/motionkit and installs its dependencies.
With reduced motion on, it appears at its final spacing straight away.
Headlines that rise letter by letter, slide up line by line, blur into focus or light up as you scroll.
Big text that scrolls on its own, speeds up as the page scrolls, turns with the scroll direction and leans into the speed.
A headline cut into bands like a sliced print: hover and the bands slide apart in alternate directions, revealing the word in a second colour through the cut.