Get the kit
Components / Text animationsv1.0.0 · updated 2026-09-30

Fit Text

Free · MIT

A binary search against Archivo's width axis (62–125) makes one line fill its container edge to edge, re-solving on resize and once web fonts load. Falls back to font-size when the narrowest width still overflows.

textvariable fontresponsive
Free
Customize
Accent

Install

No dependencies beyond React. Copy the file and import it.

  1. Copy FitText.tsx from the Code tab into components/brazen/.
  2. Make sure the Brazen tokens are loaded (tokens.css); colours and timing come from them.
  3. Import it and pass the props below.

Props 5

PropTypeDefaultDescription
childrenstring—The line to fit.
minnumber62Narrowest width-axis value.
maxnumber125Widest width-axis value.
risebooleanfalseLetters rise in on mount.
splitstring—Substring to colour with --hot.

Features

  • Variable-font width solve
  • ResizeObserver driven
  • Optional letter rise on load
  • Highlight a substring in the hot colour

Dependencies

  • react@>=19 peer

Works with

  • React 19
  • Next.js 15+
  • TypeScript

Reduced motion

Fits the line; the letter rise is skipped.

Related