---
title: "Text Variable Proximity"
description: "The letters near the pointer get bolder or wider on a variable font, and the text around them does not move."
url: https://gelatinui.com/components/text-variable-proximity
markdown_url: https://gelatinui.com/components/text-variable-proximity.md
access: pro
install: "npx shadcn@latest add @gelatin-ui-pro/text-variable-proximity"
version: "2026-11-14"
index: https://gelatinui.com/llms.txt
docs_index: https://gelatinui.com/docs/llms.txt
---

# Text Variable Proximity

> The letters near the pointer get bolder or wider on a variable font, and the text around them does not move.

Page: https://gelatinui.com/components/text-variable-proximity

## When to use it

Best for: A display heading in a variable font, where the weight or another axis follows the pointer.

- Use a variable font with the axes of `to`: the default `'wght' 900` needs a font with a weight axis. A font without the axis skips it.
- Leave out `from` to start from the weight of the text (`font-bold` starts at 700). Set `from` for an axis the text cannot give, such as `'opsz' 12`.
- Set `to` lower than the rest weight for text that gets thinner under the pointer.
- Use `falloff="index"` with `spread` for a dock of letters, and `idle` for a slow wave while the pointer is away.

## When not to use it

- For a mark on a key phrase that does not move, use [Highlight](https://gelatinui.com/components/highlight.md).
- For body text, a long paragraph, or a static font, use plain text.

## Notes for agents

- `children` must be a string. The text reads once: the still copy is `aria-hidden`, and the moving copy is plain inline text.
- Two copies: an `invisible` copy at rest stays in the flow and holds the size and the line breaks, and the moving copy lies on top of it. So a heavier letter never moves the page or the next line.
- Each line of the moving copy keeps the break of the copy at rest: a heavy line grows a few px past its end and never sends a word down. Keep a small gutter on the side where lines end.
- `from` and `to` are `font-variation-settings` values. An axis in `to` that `from` does not name, and that the text cannot give (only `wght` and `wdth` can be read), throws with a message that names the axis.
- `radius` (px, default 120) is the reach from the center of each letter, measured on the copy at rest. `ripple` is on by default.
- One passive `pointermove` listener on the window: React does not render while the pointer moves. A finger moves the weight too, and the page still scrolls.
- `idle` runs only while the pointer is away and the text is on screen. `paused` (or `defaultPaused` with `onPausedChange`) stops the wave; the pointer still moves the letters. There is no hover hold: the pointer is the effect.
- Keyboard focus on the link or button around the text sends one sweep of weight across the letters (`:focus-visible` only).
- Arabic and other joining scripts move by word. `locale` sets the split; the default comes from `DisplayLocaleProvider`. A new text or locale mounts the letters again.

## Anatomy

```text
TextVariableProximity
```

## API reference

### TextVariableProximity

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `paused` | `boolean` |  | The pause of the user or the page (controlled). |
| `defaultPaused` | `boolean` |  | The first pause when `paused` is not given (uncontrolled). Default false. |
| `onPausedChange` | `function` |  | Called when the pause changes. |
| `locale` | `string` |  | The BCP 47 locale for the letter and word split (`Intl.Segmenter`). Default: the `DisplayLocaleProvider` locale, else `"en-US"`. |
| `children` | `string` |  | The text. Its letters near the pointer move along the font axes from `from` to `to`. |
| `from` | `string` |  | The `font-variation-settings` at rest, for each axis of `to`. Any axis the font has: `wdth`, `opsz`, `slnt`, `GRAD`, or a custom one. Default: read from the text (`wght` from its `font-weight`, `wdth` from its `font-stretch`), so a `font-bold` text starts at 700. Name an axis here that the text cannot give (`opsz`). |
| `to` | `string` |  | The `font-variation-settings` under the pointer: `'wght' 900` (default). |
| `radius` | `number` |  | How far the pointer reaches, in px from the center of a letter. Default 120. |
| `falloff` | `"distance" \| "index"` |  | How the effect falls off: by the `distance` of each letter (default), or by its `index` from the letter under the pointer, as icons in a dock (`#/lib/pro/pointer-falloff-model`). |
| `spread` | `number` |  | `falloff="index"` only: how many letters on each side react. Default 2. |
| `ripple` | `boolean` |  | A press on the text sends a ring of weight out from the press point. Default on. |
| `idle` | `boolean` |  | A slow bump crosses the text while the pointer is away (2.4s a pass, then 1.2s of rest), only on screen. `paused` stops it. |

## Styling

| Part | Slot | States | CSS variables | Tokens |
| --- | --- | --- | --- | --- |
| TextVariableProximity | `text-variable-proximity` |  |  |  |

## Usage

Wrap the words of a heading set in a variable font. Leave out `from` to start from the weight of the text.

The sample also uses `button`, which this add does not write. One command adds them with this item:

```bash
npx shadcn@latest add @gelatin-ui-pro/text-variable-proximity @gelatin-ui/button
```

```tsx title="hero.tsx"
import { TextVariableProximity } from "@/components/pro/text/text-variable-proximity";
import { Button } from "@/components/ui/button";

export function Hero() {
  return (
    <section className="flex flex-col items-center gap-6 py-24 text-center">
      <p className="text-sm font-medium text-muted-foreground">Typeface release</p>
      <h1 className="text-7xl leading-tight font-light tracking-tight">
        <TextVariableProximity to="'wght' 900" radius={160} idle>
          Type with a pulse
        </TextVariableProximity>
      </h1>
      <p className="max-w-md text-lg text-muted-foreground">
        Nine weights in one file, from a hairline to a heavy black.
      </p>
      <Button size="lg" nativeButton={false} render={<a href="/fonts/pulse" />}>
        <TextVariableProximity from="'wght' 500" to="'wght' 800">
          Try the font
        </TextVariableProximity>
      </Button>
    </section>
  );
}
```

## Compose

Rules:

- Compose the parts (`compose-parts`): Build each item from its named parts as children, and pass your text and icons in as parts.
- Every state is designed (`every-state`): Give each view of data its loading, empty, and error states: a skeleton in the final layout, an `Empty` with an illustration and one next action, and an error that says what failed and how to retry.

## Add it

```bash
npx shadcn@latest add @gelatin-ui-pro/text-variable-proximity
```

It adds 27 registry items: 26 files, 4548 lines, and the npm packages `@base-ui/react`, `@mantine/hooks`, `clsx`, `motion`, `tailwind-merge`.

## For AI agents

- Every item, one file: https://gelatinui.com/llms.txt
- MCP server (`search_items`, `get_item`, `get_install_plan`): https://gelatinui.com/mcp

## Related

- [Highlight](https://gelatinui.com/components/highlight.md)
- [Magnetic](https://gelatinui.com/components/magnetic.md)

## Keyboard

| Keys | Action |
| --- | --- |
| Tab | Moves the focus to the link or button around the text. One sweep of weight crosses the letters from the start edge. |

## Motion

| Part | Motion |
| --- | --- |
| Follow | follow · spring (visual duration 0.23s, bounce 0.28) · each letter moves its axes toward its nearness, and settles back to rest when the pointer leaves |
| Ripple | progress · a ring of weight runs out from the press point at 0.8px per ms, and fades as it grows |
| Idle wave | progress · a bump halfway to `to` crosses the text in 2.4s, then rests 1.2s, only while the pointer is away |
| Focus sweep | progress · one bump crosses the text in 1.2s at full `to` on keyboard focus |
