# Tracking In

> An editorial headline whose letters start spread wide and draw together into place as it scrolls into view.

Category: Text · Free · Updated 2026-11-14 · Live demo: https://www.motionkitui.com/components/tracking-in

## When to use it

Editorial headlines, brand statements, portfolio covers and section titles on minimal, typographic sites.

## How it works

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.

## Installation

```bash
npx shadcn@latest add https://www.motionkitui.com/r/tracking-in.json
```

Or copy `components/motionkit/tracking-in.tsx` below. Requires react, motion and Tailwind CSS v4. Free for personal projects; commercial use needs MotionKit Plus (https://www.motionkitui.com/pricing).

## Props

| 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. |

## Accessibility

- **Keyboard: Not applicable.** Text, nothing to operate.
- **Screen readers: Pass.** Ordinary text with its spacing animated, so it's read normally.
- **Reduced motion: Pass.** With reduced motion on, it appears at its final spacing straight away.
- **Colour contrast: Pass.** Inherits your text colour once settled; it fades in, so contrast is only low during the first moments.

## Source

```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>
  );
}
```
