Skip to content

Text Fit

Free

Each line of a heading scales to fill the full width of its box, and stays fitted when the box resizes.

  • Base UI
  • Motion
  • React 19
  • Tailwind CSS 4

Added Nov 15, 2026 · MIT + Commons Clause

Playground

Loading the preview

Props

Put each line in a Fit Text Line part.

hero-title.tsx

TextFit

<span>
PropTypeDefaultDescription
localestring—The BCP 47 locale for the letter and word split (Intl.Segmenter). Default: the DisplayLocaleProvider locale, else "en-US".
childrenReactNode—The lines: TextFitLine parts, or a string with one line per \n.
maxSizenumberNumber.POSITIVE_INFINITYThe largest font size of a line, in px, so a short word does not grow without end.
...props<span> attributes—Every other attribute goes to the <span>, with a ref.

TextFitLine

<span>
PropTypeDefaultDescription
childrenstring—The text of the line. It never wraps.
...props<span> attributes—Every other attribute goes to the <span>, with a ref.
  • Put each line in its own Fit Text Line part.
  • Use maxSize to stop a short line from growing too large.
Resize
glide · each line scales to its new size when the box resizes
  1. AddedText Fit.
Open the release