Skip to content

Text reveal

Reveals text by line, word or character as it enters the viewport.

The text is revealed as it scrolls into view, once unless replay is set. With reduced motion it is plain text, in place from the start.

By lines

Every task in the March release has an owner, a due date and a reviewer. The notes go out on Wednesday morning.

By words

Twelve tasks shipped this month and three are still in review.

By characters

Released on Thursday

Replaying on scroll

The review is on Tuesday, the notes go out on Wednesday and the invoice follows on Friday.

Installation

npx shadcn@latest add @khaeli/text-reveal

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

Installs with

npm packages
  • motion ^12.23.12

Accessible name

  • The whole text is in the page once, in a visually hidden span, and that is what a screen reader reads. The lines, words and characters that move are aria-hidden.
  • It renders a div. Pass as for the element the text should be, such as as="h2" for a heading or as="p" for a paragraph.

Registry JSON

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