Typewriter
Char-by-char text reveal with optional per-line strikethrough. Replicates the boogie.ro hero where two "wrong-answer" lines cross themselves out before the final accent line lands. Pure CSS animations under the hood — no GSAP, no per-frame JS — so it's cheap.
· site tip 2010
· site generic AI
· site memorabil
Usage
import { Typewriter } from '@bwo-ui/react';
<Typewriter
as="h1"
lines={[
{ text: '· site tip 2010', strike: true },
{ text: '· site generic AI', strike: true },
{ text: '· site memorabil', color: 'var(--bwo-red)' },
]}
/>Each character receives its own animation-delay, computed cumulatively across all lines. Strike lines wait strikeWait seconds after the line's last char before the bar grows across them.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
lines | TypewriterLine[] | — | Lines to reveal. Each: { text, strike?, color? }. |
as | ElementType | 'h1' | Tag to render the outer element as. |
charSpeed | number | 0.032 | Seconds between each character. |
lineGap | number | 0.18 | Seconds between the end of one line and the next. |
strikeWait | number | 0.22 | Seconds after a `strike` line finishes before the bar starts. |
initialDelay | number | 0.12 | Delay before the first character animates in. |
charDuration | number | 0.6 | Per-character reveal duration. |
charEase | string | 'cubic-bezier(.16,1,.3,1)' | CSS easing for the char reveal. |
strikeDuration | number | 0.5 | Strike-bar growth duration. |
strikeEase | string | 'cubic-bezier(.4,0,.2,1)' | CSS easing for the strike bar. |
fromY | number | 30 | Initial Y offset in px (each char rises from here). |
TypewriterLine
| Prop | Type | Default | Description |
|---|---|---|---|
text | string | — | The line to type. |
strike | boolean | false | Animate a strikethrough bar across after reveal completes. |
color | string | — | Per-line colour override (e.g. accent on the final line). |
Tip: Pair with Preanimate so the typewriter only mounts (and starts revealing) after the rest of the chrome is ready.