A web component for character-by-character text animation with HTML support. Suitable for interactive storytelling, educational tutorials, chat simulations, and dynamic content presentation.
code, and nested structuresdir attributesetText() methodspeed — Characters per second (default: 100)min-duration — Minimum animation duration in ms (default: 50)max-duration — Maximum animation duration in ms (default: 500)autostart — Auto-start on load, set to "false" to disable (default: true)dir — Text direction: "ltr" or "rtl" (default: ltr)respect-motion-preference — Respect prefers-reduced-motion media query (default: false)aria-label — ARIA label for the container regionstart() — Begin animation from startpause() — Pause animationresume() — Resume paused animationcomplete() — Display all content instantlyreset() — Clear content and reset statesetText(html) — Replace content and resetstart — Dispatched when animation beginspause — Dispatched when animation pausesresume — Dispatched when animation resumescomplete — Dispatched when animation finishesreset — Dispatched when component resetsprogress — Dispatched every 10 characters with {current, total, percent}يدعم المكوّن النصوص العربية مع الحفاظ على الاتجاه الصحيح. يمكن دمج الروابط والنصوص الإنجليزية مثل TypeWriter داخل المحتوى العربي.
الأكواد والعناصر المضمنةSee TypeWriter Web Component V2 → with enhanced seek functionality, allowing to jump to any position in the animation timeline. Includes scrub controls, percentage-based seeking, improved pause/resume behavior, and better UI state management.
Built using Custom Elements API. Uses Light DOM for CSS inheritance. Whitespace normalization collapses consecutive spaces and skips formatting whitespace. Works in modern browsers supporting Custom Elements.