Playground

Text reveal

Fade a sentence in word by word. Static for reduced motion.

  • Built on native elements
  • The text stays real text in reading order; nothing is hidden from assistive tech.
  • With prefers-reduced-motion every word is visible at once.
  • Styles in one file: text-reveal.css

Import

import '@monoline/css';
import {TextReveal} from '@monoline/react';

Not installed yet? Pick a route.

Copies the source and its styles into your project.

npx monoline add text-reveal

Usage

import {TextReveal} from '@monoline/react';

<TextReveal
  text="Every word arrives in turn, so the eye can follow the sentence."
  style={{fontFamily: 'var(--font-display)', fontSize: 'var(--display-sm)'}}
/>

Examples

Default

Slower

Props

TextRevealProps

PropTypeDefaultDescription
text requiredstring–The sentence to reveal, word by word.
staggernumber80Milliseconds between words. Default 80.

Data Attributes

State is exposed through attributes. Style it with these selectors, not with class toggles.

This component sets no state attributes.

CSS classes

ClassStylesheet
.text-reveal-wordtext-reveal.css

Customization

Style it with the kit's tokens in your own CSS, loaded after @monoline/css. Prefer the attributes above over extra classes. See Theming for every token.

app.css
.text-reveal-word {
  border-color: var(--accent);
}

Accessibility

  • The text stays real text in reading order; nothing is hidden from assistive tech.
  • With prefers-reduced-motion every word is visible at once.