Searching Open Sourcery

Type to search Open Sourcery.

Motion & Scroll

Split Text

Text reveals by word, character, or line, split from the real layout. Eight effects, no dependencies.

v0.2.0@magic-spells/split-text

$ npm i @magic-spells/split-text

GitHubnpmSee it on the showcase →

Live demo

Text that makes an entrance

Effect

<split-text effect="rise" split="chars">

Pick an effect and replay it — the split and the reveal are the element’s own.

About

Lightweight text-reveal web component. Splits text into words, characters, or detected lines, then animates each unit with a CSS-driven stagger. Eight built-in effects — rise, drop, slide, bloom, two 3D spins, and a per-character magnetic scatter — plus a registry for writing your own. No dependencies. No framework. ~2.7 KB gzipped (JS) + 0.9 KB (CSS).

Features

  • Three split modes: words, chars, lines (auto-detected from layout)
  • Eight effects: rise (default), drop, slide-right, slide-left, bloom, spin-x, spin-y, magnetic
  • Custom effects are just CSS — add a keyframe, get a new effect value
  • CSS-only animation — transform, opacity, and filter, GPU-accelerated
  • Triggers when scrolled into view by default (configurable: load, manual)
  • Preserves inline markup (`, , , `) inside the host

Usage

<split-text>The quick brown fox jumps over the lazy dog.</split-text>

Attributes

AttributeDefaultDescription
splitwordswords, chars, or lines
effectriserise, drop, slide-right, slide-left, bloom, spin-x, spin-y, magnetic
delay0Initial delay before animation starts (ms)
stagger30Delay between each unit (ms)
duration800Animation duration per unit (ms)
easingcubic-bezier(0.16, 1, 0.3, 1)CSS easing function
triggervisiblevisible, load, or manual
offset20%Distance above bottom of viewport before firing (px or %; set 0 to disable)

About, features, usage and options are taken from the package README.