Skip to content

Fit text

Scales one line of text to fill its parent's width.

Put it in a block-level parent as wide as the line should be, one FitText per line. It sizes itself in the browser after the page loads, so the line is the inherited size until then.

One line

Release notes

Stacked lines

Every task
shipped on
Thursday

Following its container

Invoice 0142

Installation

npx shadcn@latest add @khaeli/fit-text

Install @khaeli/foundation first: this item's styling lives in its tokens and [data-slot] rules.

Installs with

Registry items

Accessible name

  • It renders a plain span: the text is read as written, with no role and no name of its own.

Registry JSON

The item as the shadcn CLI reads it, with every file it ships: https://ui.khaeli.com/r/fit-text.json