Ballmac UI home

Typing Text

A typewriter that types and erases one or several strings with natural timing and a blinking caret, starting on scroll if you like, with the whole text available to screen readers.

Build a landing page. dashboard. design system. mobile app

Installation

$ pnpm dlx shadcn@latest add @ballmac/typing-text

Usage

import { TypingText } from "@/components/ballmac/typing-text"

The full example is in the Code tab above.

Examples

Type once with a caret

$ pnpm dlx shadcn@latest add

@ballmac/button @ballmac/card @ballmac/dialog

API reference

PropTypeDefault
text*

One string to type, or several to type and erase in turn.

string | string[]—
typingSpeed

Milliseconds per typed character.

number55
deleteSpeed

Milliseconds per erased character.

number28
pause

Milliseconds to hold a finished string before erasing it.

number1600
loop

Start again after the last string. A single string only loops when this is set.

boolean—
cursor

Show a blinking caret.

booleantrue
startOnView

Wait for the text to scroll into view before typing.

booleanfalse
onComplete

Called after the final string is fully typed (when not looping).

() => void—

Also accepts the standard attributes of its root element.

Accessibility

KeyAction
Screen readersAll strings are available as hidden text; the typing itself is aria-hidden
Reduced motionThe first string (or the last, when not looping) is shown whole with no caret blink

Use with AI

<TypingText text={['one','two']} typingSpeed deleteSpeed pause loop cursor startOnView onComplete />. A single string types once unless loop is set. With the shadcn MCP server set up (guide), ask your agent:

Add the Ballmac UI Typing Text (@ballmac/typing-text) to this project with the shadcn MCP, then use it where it fits.

Use it for

  • Hero lines that cycle through use cases
  • Terminal-style intros

Not for

  • Streaming AI output (streaming-text)
  • Long copy

Registry JSON: https://ui.ballmac.com/r/typing-text.json

Credits

Free to use in personal and commercial projects.