Typography & Text
The 11 effects T01–T11: purpose, API, options, examples, reduced motion and cost.
Experimental and not on npm
Text effects split text without hiding it from anyone: one accessible copy keeps the original nodes and the visual pieces are aria-hidden. Grapheme clusters, bidirectional text and shaping scripts are respected; links and controls are never split. Each effect writes one value per frame and text.css does the per-piece math; without it the text is visible and static. Long texts are limited by maxPieces. All return a control with play, pause, seek, track and drive.
T01 · Split reveal
<TextReveal> reveals split pieces (chars, words or lines) with a variant such as fade-up or blur; stagger and order shape the sequence. Line pieces regroup on resize without replaying.
- Import
@neshel-ui/animations/text- API
TextReveal, createTextReveal- Stylesheet
@neshel-ui/animations/text.css- Reduced motion
instant— the end state appears at once- Performance
- One write per frame on the visual root and CSS per piece; the cost grows with the number of pieces.
Rooted in faith, built with hope.
"use client";
import "@neshel-ui/animations/text.css";
import { TextReveal } from "@neshel-ui/animations/text";
import { Button } from "@neshel-ui/components";
import { useState } from "react";
export default function T01Example() {
const [run, setRun] = useState(0);
return (
<div className="grid justify-items-start gap-3">
<TextReveal key={run} as="p" split="words" variant="fade-up" trigger="mount">
Rooted in faith, built with hope.
</TextReveal>
<Button variant="outline" onClick={() => setRun(run + 1)}>
Replay
</Button>
</div>
);
}Options: TextRevealOptions
TextRevealOptions
| Prop | Type | Default | Description |
|---|---|---|---|
| distance | string | "0.6em" | CSS length of the slide (default "0.6em"). |
| duration | number | — | ms (0–10000; default per effect). |
| easing | Easing | EasingPreset | — | — |
| locale | string | — | — |
| maxPieces | number | — | — |
| onComplete | (result: MotionResult) => void | — | — |
| order | RevealOrder | "start" | Default "start". |
| progress | ProgressSource | — | Drive the effect from a 0–1 source (ScrollProgress, motion value, …) instead of its clock. |
| reducedMotion | ReducedMotion | — | — |
| seed | number | — | Seed of order: "random" (deterministic). |
| split | SplitGranularity | "words" | Default "words". |
| stagger | number | — | Overlap between pieces: 0 (together) … 1 (one after another); default 0.2. |
| trigger | TextTrigger | "visible" | When the effect plays by itself (default "visible"). Ignored with progress. |
| variant | RevealVariant | "fade-up" | Default "fade-up". |
T02 · Typewriter
<Typewriter> shows speed graphemes per second with an optional caret. The full sentence is accessible from the start, the layout does not move, and finish() shows everything.
- Import
@neshel-ui/animations/text- API
Typewriter, createTypewriter- Stylesheet
@neshel-ui/animations/text.css- Reduced motion
instant— the end state appears at once- Performance
- One write per frame on the visual root and CSS per piece; the cost grows with the number of pieces.
"use client";
import "@neshel-ui/animations/text.css";
import { Typewriter } from "@neshel-ui/animations/text";
import { Button } from "@neshel-ui/components";
import { useState } from "react";
export default function T02Example() {
const [run, setRun] = useState(0);
return (
<div className="grid justify-items-start gap-3">
<Typewriter key={run} speed={30} caret="typing" trigger="mount">
The complete sentence is accessible from the first frame.
</Typewriter>
<Button variant="outline" onClick={() => setRun(run + 1)}>
Replay
</Button>
</div>
);
}Options: TypewriterOptions
TypewriterOptions
| Prop | Type | Default | Description |
|---|---|---|---|
| caret | "typing" | "always" | "none" | — | "typing" (default): caret while typing; "always": also at rest; "none". |
| duration | number | — | ms (0–10000; default per effect). |
| easing | Easing | EasingPreset | — | — |
| locale | string | — | — |
| maxPieces | number | — | — |
| onComplete | (result: MotionResult) => void | — | — |
| progress | ProgressSource | — | Drive the effect from a 0–1 source (ScrollProgress, motion value, …) instead of its clock. |
| reducedMotion | ReducedMotion | — | — |
| speed | number | — | Graphemes per second (1–200; default 30). |
| trigger | TextTrigger | "visible" | When the effect plays by itself (default "visible"). Ignored with progress. |
T03 · Scramble
<ScrambleText> decodes from random glyphs of charset; the same seed always gives the same sequence, at most rate changes per second. Width and line breaks never change.
- Import
@neshel-ui/animations/text- API
ScrambleText, createScramble- Stylesheet
@neshel-ui/animations/text.css- Reduced motion
instant— the end state appears at once- Performance
- One write per frame on the visual root and CSS per piece; the cost grows with the number of pieces.
"use client";
import "@neshel-ui/animations/text.css";
import { ScrambleText } from "@neshel-ui/animations/text";
import { Button } from "@neshel-ui/components";
import { useState } from "react";
export default function T03Example() {
const [run, setRun] = useState(0);
return (
<div className="grid justify-items-start gap-3">
<ScrambleText key={run} seed={3} trigger="mount">
DETERMINISTIC DECODE
</ScrambleText>
<Button variant="outline" onClick={() => setRun(run + 1)}>
Replay
</Button>
</div>
);
}Options: ScrambleOptions
ScrambleOptions
| Prop | Type | Default | Description |
|---|---|---|---|
| charset | string | — | Glyphs shown while decoding (split into graphemes; default letters, digits and symbols). |
| duration | number | — | ms (0–10000; default per effect). |
| easing | Easing | EasingPreset | — | — |
| locale | string | — | — |
| maxPieces | number | — | — |
| onComplete | (result: MotionResult) => void | — | — |
| progress | ProgressSource | — | Drive the effect from a 0–1 source (ScrollProgress, motion value, …) instead of its clock. |
| rate | number | — | Glyph changes per second (1–60; default 24). |
| reducedMotion | ReducedMotion | — | — |
| seed | number | 1 | Seed of the glyph sequence (default 1). |
| trigger | TextTrigger | "visible" | When the effect plays by itself (default "visible"). Ignored with progress. |
T04 · Gradient sweep
<GradientText> sweeps a band of color across text that otherwise keeps its own colour; repeat is 0 by default. In forced colours it is plain text. Check the contrast of the band colour.
- Import
@neshel-ui/animations/text- API
GradientText, createGradientSweep- Stylesheet
@neshel-ui/animations/text.css- Reduced motion
static— the decoration or content stays still- Performance
- Repaints the element (colour, gradient, clip, mask, blur or stroke) while it runs; keep the area small.
A band of colour
"use client";
import "@neshel-ui/animations/text.css";
import { GradientText } from "@neshel-ui/animations/text";
import { Button } from "@neshel-ui/components";
import { useState } from "react";
export default function T04Example() {
const [run, setRun] = useState(0);
return (
<div className="grid justify-items-start gap-3">
<p className="text-3xl font-bold">
<GradientText key={run} color="#b45309" trigger="mount">
A band of colour
</GradientText>
</p>
<Button variant="outline" onClick={() => setRun(run + 1)}>
Replay
</Button>
</div>
);
}Options: GradientSweepOptions
GradientSweepOptions
| Prop | Type | Default | Description |
|---|---|---|---|
| angle | number | 100 | Gradient angle in degrees (default 100). |
| color | string | var(--neshel-primary, #6366f1) | Highlight colour (CSS; default var(--neshel-primary, #6366f1)). |
| duration | number | — | One cycle, ms (default per effect). |
| onComplete | () => void | — | — |
| reducedMotion | ReducedMotion | — | — |
| repeat | number | — | Extra cycles (0–1000 or Infinity, explicit). |
| trigger | TextTrigger | "visible" | visible/mount start the loop on creation (default "visible"); manual waits for play(). |
| width | number | — | Band half-width as a fraction of the element (0.05–0.5; default 0.25). |
T05 · Number roll
<NumberRoll> rolls digit columns to a new value formatted with locale and format (Intl). Assistive technology reads the formatted number once per change; there is no live region.
- Import
@neshel-ui/animations/text- API
NumberRoll, createNumberRoll- Stylesheet
@neshel-ui/animations/text.css- Reduced motion
instant— the end state appears at once- Performance
- One write per frame on the visual root and CSS per piece; the cost grows with the number of pieces.
1.234,50 €
"use client";
import "@neshel-ui/animations/text.css";
import { NumberRoll } from "@neshel-ui/animations/text";
import { Button } from "@neshel-ui/components";
import { useState } from "react";
export default function T05Example() {
const [value, setValue] = useState(1234.5);
return (
<div className="flex items-center gap-4">
<p className="text-3xl">
<NumberRoll value={value} locale="de-DE" format={{ style: "currency", currency: "EUR" }} />
</p>
<Button variant="outline" onClick={() => setValue(value + 987.6)}>
Add
</Button>
</div>
);
}Options: NumberRollOptions
NumberRollOptions
| Prop | Type | Default | Description |
|---|---|---|---|
| duration | number | 800 | ms (default 800). |
| easing | Easing | EasingPreset | — | — |
| format | Intl.NumberFormatOptions | — | — |
| locale | string | — | — |
| reducedMotion | ReducedMotion | — | — |
| value(required) | number | bigint | — | — |
T06 · Rotating words
<RotatingWords> shows words one at a time every interval ms in a box as wide as the longest, so nothing shifts. It pauses on hover, focus and off screen; accessibleText is the single text read aloud.
- Import
@neshel-ui/animations/text- API
RotatingWords, createRotatingWords- Stylesheet
@neshel-ui/animations/text.css- Reduced motion
static— the decoration or content stays still- Performance
- One write per frame on the visual root and CSS per piece; the cost grows with the number of pieces.
Design systems that are calm
"use client";
import "@neshel-ui/animations/text.css";
import { RotatingWords, type RotatingWordsControl } from "@neshel-ui/animations/text";
import { Button } from "@neshel-ui/components";
import { useRef } from "react";
export default function T06Example() {
const words = useRef<RotatingWordsControl | null>(null);
return (
<div className="grid justify-items-start gap-3">
<p className="text-xl">
Design systems that are{" "}
<RotatingWords controlRef={words} words={["calm", "modular", "accessible"]} />
</p>
<Button variant="outline" onClick={() => words.current?.pause()}>
Pause
</Button>
</div>
);
}Options: RotatingWordsOptions
RotatingWordsOptions
| Prop | Type | Default | Description |
|---|---|---|---|
| accessibleText | string | — | Accessible text (default: the words joined by ", "). |
| duration | number | — | Swap transition ms (0–2000; default 450). |
| interval | number | — | ms each word stays (1000–20000; default 2500). |
| onComplete | () => void | — | — |
| pauseOnHover | boolean | true | Pause while hovered or focused (default true). |
| reducedMotion | ReducedMotion | — | — |
| repeat | number | — | Extra cycles (0–1000 or Infinity, explicit). |
| trigger | TextTrigger | "visible" | visible/mount start the loop on creation (default "visible"); manual waits for play(). |
| variant | "slide-up" | "slide-down" | "fade" | — | — |
| words(required) | readonly string[] | — | — |
T07 · Kinetic wave
<WaveText> moves graphemes in a sine wave of amplitude for repeat extra cycles and returns to rest. It is decorative and off under reduced motion; keep it for short words.
- Import
@neshel-ui/animations/text- API
WaveText, createTextWave- Stylesheet
@neshel-ui/animations/text.css- Reduced motion
off— no motion at all- Performance
- One write per frame on the visual root and CSS per piece; the cost grows with the number of pieces.
"use client";
import "@neshel-ui/animations/text.css";
import { WaveText } from "@neshel-ui/animations/text";
import { Button } from "@neshel-ui/components";
import { useState } from "react";
export default function T07Example() {
const [run, setRun] = useState(0);
return (
<div className="grid justify-items-start gap-3">
<WaveText key={run} amplitude="0.25em" repeat={1} trigger="mount">
A wave that ends
</WaveText>
<Button variant="outline" onClick={() => setRun(run + 1)}>
Replay
</Button>
</div>
);
}Options: TextWaveOptions
TextWaveOptions
| Prop | Type | Default | Description |
|---|---|---|---|
| amplitude | string | "0.18em" | CSS length (default "0.18em"; keep ≤ 0.5em). |
| duration | number | — | One cycle, ms (default per effect). |
| locale | string | — | — |
| maxPieces | number | — | — |
| onComplete | () => void | — | — |
| reducedMotion | ReducedMotion | — | — |
| repeat | number | — | Extra cycles (0–1000 or Infinity, explicit). |
| spread | number | — | Phase offset between clusters in radians (0–3; default 0.5). |
| trigger | TextTrigger | "visible" | visible/mount start the loop on creation (default "visible"); manual waits for play(). |
T08 · Highlighter
<Highlight> draws a marker band or an underline (variant) behind inline text, across line breaks and in the reading direction. Forced colours draw a system underline instead. Use <mark> semantics yourself if the meaning matters.
- Import
@neshel-ui/animations/text- API
Highlight, createHighlighter- Stylesheet
@neshel-ui/animations/text.css- Reduced motion
instant— the end state appears at once- Performance
- Repaints the element (colour, gradient, clip, mask, blur or stroke) while it runs; keep the area small.
Contrast is checked for you at build time.
"use client";
import "@neshel-ui/animations/text.css";
import { Highlight } from "@neshel-ui/animations/text";
import { Button } from "@neshel-ui/components";
import { useState } from "react";
export default function T08Example() {
const [run, setRun] = useState(0);
return (
<div className="grid justify-items-start gap-3">
<p>
Contrast is{" "}
<Highlight key={run} trigger="mount">
checked for you
</Highlight>{" "}
at build time.
</p>
<Button variant="outline" onClick={() => setRun(run + 1)}>
Replay
</Button>
</div>
);
}Options: HighlighterOptions
HighlighterOptions
| Prop | Type | Default | Description |
|---|---|---|---|
| color | string | — | Band colour (CSS; default translucent yellow, --neshel-highlight-color). |
| duration | number | — | ms (0–10000; default per effect). |
| easing | Easing | EasingPreset | — | — |
| onComplete | (result: MotionResult) => void | — | — |
| progress | ProgressSource | — | Drive the effect from a 0–1 source (ScrollProgress, motion value, …) instead of its clock. |
| reducedMotion | ReducedMotion | — | — |
| trigger | TextTrigger | "visible" | When the effect plays by itself (default "visible"). Ignored with progress. |
| variant | "marker" | "underline" | — | "marker" (default; most of the line height) or "underline" (a low band). |
T09 · Text mask
<TextMask> reveals lines with variant "rise" (inside clipped line boxes) or "wipe"; scope: "element" masks the whole element instead. Without mask support the text is simply visible.
- Import
@neshel-ui/animations/text- API
TextMask, createTextMask- Stylesheet
@neshel-ui/animations/text.css- Reduced motion
instant— the end state appears at once- Performance
- One write per frame on the visual root and CSS per piece; the cost grows with the number of pieces.
Each line rises inside its own box, so nothing around it moves.
"use client";
import "@neshel-ui/animations/text.css";
import { TextMask } from "@neshel-ui/animations/text";
import { Button } from "@neshel-ui/components";
import { useState } from "react";
export default function T09Example() {
const [run, setRun] = useState(0);
return (
<div className="grid justify-items-start gap-3">
<TextMask key={run} as="p" variant="rise" trigger="mount" className="max-w-[32ch]">
Each line rises inside its own box, so nothing around it moves.
</TextMask>
<Button variant="outline" onClick={() => setRun(run + 1)}>
Replay
</Button>
</div>
);
}Options: TextMaskOptions
TextMaskOptions
| Prop | Type | Default | Description |
|---|---|---|---|
| duration | number | — | ms (0–10000; default per effect). |
| easing | Easing | EasingPreset | — | — |
| locale | string | — | — |
| onComplete | (result: MotionResult) => void | — | — |
| progress | ProgressSource | — | Drive the effect from a 0–1 source (ScrollProgress, motion value, …) instead of its clock. |
| reducedMotion | ReducedMotion | — | — |
| scope | "lines" | "element" | — | — |
| stagger | number | 0.25 | Line overlap 0–1 (default 0.25). |
| trigger | TextTrigger | "visible" | When the effect plays by itself (default "visible"). Ignored with progress. |
| variant | "rise" | "wipe" | — | — |
T10 · Variable-font axes
<FontAxes> animates variable-font axes between from and to, toggled with active. Registered axes use the high-level CSS properties and custom ones merge with your variation settings; a static font jumps between its weights.
- Import
@neshel-ui/animations/text- API
FontAxes, createFontAxes- Stylesheet
- none needed
- Reduced motion
static— the decoration or content stays still- Performance
- Changing font axes lays the text out again on each frame; use it on short texts.
Variable weight
"use client";
import { FontAxes } from "@neshel-ui/animations/text";
import { Button } from "@neshel-ui/components";
import { useState } from "react";
export default function T10Example() {
const [bold, setBold] = useState(false);
return (
<div className="grid justify-items-start gap-3">
<p className="text-2xl">
<FontAxes from={{ wght: 300 }} to={{ wght: 800 }} active={bold}>
Variable weight
</FontAxes>
</p>
<Button variant="outline" aria-pressed={bold} onClick={() => setBold(!bold)}>
Bold
</Button>
</div>
);
}Options: FontAxesOptions
FontAxesOptions
| Prop | Type | Default | Description |
|---|---|---|---|
| duration | number | — | ms (0–10000; default per effect). |
| easing | Easing | EasingPreset | — | — |
| from(required) | FontAxes | — | — |
| onComplete | (result: MotionResult) => void | — | — |
| progress | ProgressSource | — | Drive the effect from a 0–1 source (ScrollProgress, motion value, …) instead of its clock. |
| reducedMotion | ReducedMotion | — | — |
| to(required) | FontAxes | — | — |
| trigger | TextTrigger | "visible" | When the effect plays by itself (default "visible"). Ignored with progress. |
T11 · Line reveal on scroll
<LineReveal> reveals lines from a source — a ScrollProgress, a motion value — in mode "scrub", or once past a threshold with "enter". Under reduced motion every line is shown.
- Import
@neshel-ui/animations/text- API
LineReveal, createLineReveal- Stylesheet
@neshel-ui/animations/text.css- Reduced motion
instant— the end state appears at once- Performance
- One write per frame on the visual root and CSS per piece; the cost grows with the number of pieces.
The text family receives progress as a value and never imports the scroll family.
"use client";
import "@neshel-ui/animations/text.css";
import { motionValue } from "@neshel-ui/animations/core";
import { LineReveal } from "@neshel-ui/animations/text";
import { useMemo } from "react";
export default function T11Example() {
const source = useMemo(() => motionValue(1), []);
return (
<div className="grid gap-3">
<label className="grid gap-1">
Progress (pass a ScrollProgress on a page)
<input
type="range"
min={0}
max={1}
step={0.01}
defaultValue={1}
onChange={(event) => source.set(Number(event.currentTarget.value))}
/>
</label>
<LineReveal source={source} mode="scrub" className="max-w-[36ch]">
The text family receives progress as a value and never imports the scroll family.
</LineReveal>
</div>
);
}Options: LineRevealOptions
LineRevealOptions
| Prop | Type | Default | Description |
|---|---|---|---|
| distance | string | "0.6em" | CSS length of the slide (default "0.6em"). |
| duration | number | — | ms (0–10000; default per effect). |
| easing | Easing | EasingPreset | — | — |
| locale | string | — | — |
| maxPieces | number | — | — |
| mode | "scrub" | "enter" | — | "scrub" (default): lines follow the source; "enter": play once past threshold. |
| onComplete | (result: MotionResult) => void | — | — |
| order | RevealOrder | "start" | Default "start". |
| reducedMotion | ReducedMotion | — | — |
| seed | number | — | Seed of order: "random" (deterministic). |
| source | ProgressSource | — | 0–1 progress source; required for scrub, optional for enter (default IntersectionObserver). |
| stagger | number | — | Overlap between pieces: 0 (together) … 1 (one after another); default 0.2. |
| threshold | number | 0.25 | enter threshold 0–1 (default 0.25). |
| variant | RevealVariant | "fade-up" | Default "fade-up". |