motion-font
Animates one or more variable font axes — weight, optical size, width, or any custom axis — using Motion One spring physics.
Three trigger modes: auto (viewport entry), hover (mouse/focus), and scroll (axis tracks scroll position).
Requires a variable font with the targeted axes.
Hover — weight
The most common use: bold on hover with a spring-back on leave.
Auto — viewport reveal
Animates the axis once when the element scrolls into view. Ideal for hero headings that gain weight on entrance.
Scroll — tied to position
The axis value maps directly to scroll progress — from when the element enters the viewport, to when it exits. No spring; direct 1:1 mapping. Works best in real page context — see the showcase.
Multiple axes
Use the axes prop to animate several axes at once. Format: space-separated tag:from:to triplets. Overrides axis, from, and to.
Bounce
Control spring overshoot with bounce (0–1). Higher values overshoot and snap back.
bounce=0 bounce=0.3 bounce=0.6 Delay
Delay the animation start in seconds — useful for staggering multiple reveals.
Properties
| Attribute | Property | Type | Default | Description |
|---|---|---|---|---|
| | | string | 'wght' | Font axis tag — 'wght', 'wdth', 'opsz', or any custom axis. Ignored when axes is set. |
| | | string | '' | Multi-axis: space-separated tag:from:to triplets, e.g. "wght:300:800 opsz:8:32". Overrides axis, from, to. |
| | | number | 300 | Starting axis value. Ignored when axes is set. |
| | | number | 700 | Target axis value. Ignored when axes is set. |
| | | number | 0.6 | Spring duration hint in seconds. |
| | | number | 0 | Spring bounciness 0–1. 0 = no overshoot, 1 = very bouncy. |
| | | number | 0 | Delay before animation starts in seconds. |
| | | string | 'auto' | 'auto' — viewport entry | 'hover' — mouseenter / focusin | 'scroll' — axis tracks scroll position |
| | | boolean | true | For trigger='auto': animate only on the first intersection. |
Methods
| Method | Type | Default | Description |
|---|---|---|---|
| | void | — | Reset axis to from and re-run the entrance animation. Only has effect for trigger="auto". |
Variable font required: the targeted axis must exist in the loaded font. Inter supports wght (100–900) and opsz (14–32). For wdth use a font like Roboto Flex.
Accessibility
Respects prefers-reduced-motion: when enabled, axis animations are skipped and the font renders at its target value immediately.