RizzyUI

Typing Animation

RzTypingAnimation renders typewriter-style text for one string or a sequence of words. It is a single component backed by Alpine.js that emits stable SSR markup with a predictable root Id, making it straightforward to replace with HTMX partial swaps.

Basic Usage

Source
<RzTypingAnimation>Hello World! 👋</RzTypingAnimation>

Multiple Words and Looping

Source
<RzTypingAnimation Words="@(["Design 🎨", "Build 🔨", "Ship 🚀"])" Loop="true" />

Timing Controls

Source
<RzTypingAnimation
    Words="@(["Fast typing", "Slow delete"])"
    TypeSpeed="50"
    DeleteSpeed="150"
    PauseDelay="2000"
    Delay="300"
    Loop="true" />

Cursor Options

Source
<RzTypingAnimation Words="@(["No cursor"])" ShowCursor="false" />
<RzTypingAnimation Words="@(["Blink on"])" BlinkCursor="true" Loop="true" />
<RzTypingAnimation Words="@(["Blink off"])" BlinkCursor="false" Loop="true" />
<RzTypingAnimation Words="@(["Line cursor"])" CursorStyle="TypingAnimationCursorStyle.Line" Loop="true" />
<RzTypingAnimation Words="@(["Block cursor"])" CursorStyle="TypingAnimationCursorStyle.Block" Loop="true" />
<RzTypingAnimation Words="@(["Underscore cursor"])" CursorStyle="TypingAnimationCursorStyle.Underscore" Loop="true" />

Start on View

Source
<div class="min-h-[32rem]">
    <div class="h-56"></div>
    <RzTypingAnimation Words="@(["Starts when visible"])" StartOnView="true" />
</div>

HTMX Integration

Source
<div id="typing-animation-region">
    <RzTypingAnimation Words="@(["Initial", "Server state"])" Loop="true" />
</div>

<RzButton
    hx-get="/components/typing-animation/partial"
    hx-target="#typing-animation-region"
    hx-swap="outerHTML">
    Replace Animation via HTMX
</RzButton>
Source
app.MapGet("/components/typing-animation/partial", () =>
{
    return Results.Content(
        "<div id=\"typing-animation-region\"><span>...server-rendered RzTypingAnimation output...</span></div>",
        "text/html");
});

Non-Loop Final Word Behavior

Source
<RzTypingAnimation Words="@(["Plan", "Build", "Done"])" Loop="false" />

Component Parameters

PropertyDescriptionTypeDefault
ChildContentText source used when Words is not supplied.RenderFragment?null
WordsSequence of words or phrases to animate.IReadOnlyList<string>?null
DurationBase typing speed in milliseconds per character.int100
TypeSpeedOptional typing-speed override.int?null
DeleteSpeedOptional delete-speed override, defaults to half typing speed.int?null
DelayInitial delay before first typing tick.int0
PauseDelayPause duration after a word is fully typed.int1000
LoopRepeats the sequence continuously when true.boolfalse
StartOnViewDefers starting until visible in the viewport.booltrue
ShowCursorRenders the cursor slot when true.booltrue
BlinkCursorApplies blink animation class to the visible cursor.booltrue
CursorStyleControls line, block, or underscore cursor glyph.TypingAnimationCursorStyleTypingAnimationCursorStyle.Line
ElementOverrides the outer root element tag.string?"span"
IdStable id used for Alpine root mapping and replacement targeting.string?auto-generated

Interoperability Note

The Alpine state machine is internal implementation detail. Supported integration is SSR replacement (for example, HTMX swaps) or full server rerender, not direct consumer calls into Alpine methods.