---
title: "Text Typewriter"
description: "Text types out letter by letter with a blinking caret, holds, then erases and types the next line."
url: https://gelatinui.com/components/text-typewriter
markdown_url: https://gelatinui.com/components/text-typewriter.md
access: free
install: "npx shadcn@latest add @gelatin-ui/text-typewriter"
registry_item: https://gelatinui.com/r/text-typewriter.json
version: "2026-11-14"
index: https://gelatinui.com/llms.txt
docs_index: https://gelatinui.com/docs/llms.txt
---

# Text Typewriter

> Text types out letter by letter with a blinking caret, holds, then erases and types the next line.

Page: https://gelatinui.com/components/text-typewriter

## When to use it

Best for: A short line that types, holds, and changes in a hero, a prompt field, or a chat answer.

- Use it when the act of typing is the point: a prompt idea, a search sample, an assistant that writes.
- Give one text to type it once and keep it, or more texts to type, hold, and erase each in turn.
- Set `natural` and `mistakes` for a line that must read as a person at a keyboard.

## When not to use it

- For text that streams in from a model as it comes, use [Text Streaming](https://gelatinui.com/components/text-streaming.md).
- For a number that counts to its value, use [Count Up](https://gelatinui.com/components/count-up.md).

## Notes for agents

- `texts` is a list of strings. One text types once and calls `onComplete`; more texts loop by default (`loop`).
- `trigger` is `view` (default: the first time it is on screen) or `mount`. Off screen or in a hidden tab it ends the current text, then waits.
- `typeSpeed`, `deleteSpeed`, and `hold` are seconds (0.05, 0.03, 1.6). A negative or missing number uses the default.
- `reserveSpace` (default true) keeps the size of the largest text from the first paint, so the page never moves. Turn it off at the end of a line.
- `erase` is `character`, `word`, or `all`. `mistakes` is a share from 0 to 1 and hits Latin letters only; the same text has the same typos on the server and in the browser.
- A mouse over it, or keyboard focus on the link or button around it, holds it after the current text (`pauseOnHover`). `paused` holds it from the page.

## Anatomy

```text
TextTypewriter
```

## API reference

### TextTypewriter

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `paused` | `boolean` |  | The pause of the user or the page (controlled). |
| `defaultPaused` | `boolean` |  | The first pause when `paused` is not given (uncontrolled). Default false. |
| `onPausedChange` | `function` |  | Called when the pause changes. |
| `pauseOnHover` | `boolean` |  | Hold the motion while a mouse is over the item, or keyboard focus is on the link or button around it (or in it). Default true. |
| `locale` | `string` |  | The BCP 47 locale for the letter and word split (`Intl.Segmenter`). Default: the `DisplayLocaleProvider` locale, else `"en-US"`. |
| `texts` | `readonly string[]` |  | The texts to type, in order. One text types once; more texts type, hold, and delete in turn. |
| `loop` | `boolean` | texts.length > 1 | Start again from the first text after the last one. Default: on for more than one text. |
| `trigger` | `"mount" \| "view"` | "view" | When typing starts: `view` (default) the first time it is on screen, `mount` at once. |
| `typeSpeed` | `number` | TYPEWRITER_TIMING.typeSpeed | Seconds per letter typed. Default 0.05. |
| `deleteSpeed` | `number` | TYPEWRITER_TIMING.deleteSpeed | Seconds per letter deleted. Default 0.03. |
| `hold` | `number` | TYPEWRITER_TIMING.hold | Seconds a full text stays before it is erased. Default 1.6. |
| `natural` | `boolean` | false | Type like a person: the pace changes from key to key around `typeSpeed`, with a short pause after a space and a longer one after a comma or the end of a sentence. Default false: an even pace. |
| `mistakes` | `number` | 0 | The share of letters typed wrong first, from 0 to 1. A typo is the key next to the right one on a QWERTY row (Latin letters only); the caret backs up over it and types it again. The same text always has the same typos, so the server and the browser agree. Default 0. |
| `erase` | `"all" \| "character" \| "word"` | "character" | How a full text leaves before the next one: `character` (default) one letter at a time, `word` one word at a time, or `all` as a select-all that shows, then goes at once. |
| `caret` | `boolean` | true | Show the blinking caret. Default true. |
| `reserveSpace` | `boolean` | true | Keep the size of the largest text from the start, so the page around it never moves. Default true. Turn it off for a typewriter at the end of a line, where the empty space shows. |
| `onComplete` | `function` |  | Called when the last text is typed and stays (never with `loop`). |

## Styling

| Part | Slot | States | CSS variables | Tokens |
| --- | --- | --- | --- | --- |
| TextTypewriter | `text-typewriter` | `data-offscreen`, `data-phase` |  |  |

## Usage

Give it the texts: it types each one, holds it, erases it, and types the next.

```tsx title="hero-heading.tsx"
import { TextTypewriter } from "@/components/text/text-typewriter";

export function HeroHeading() {
  return (
    <section className="flex flex-col items-center gap-3 text-center">
      <h1 className="text-4xl font-semibold tracking-tight">
        The UI kit for{" "}
        <TextTypewriter
          texts={["design systems", "product teams", "solo founders"]}
          natural
          className="text-primary"
        />
      </h1>
      <p className="text-muted-foreground">
        Free components and blocks you own, in your own repo.
      </p>
    </section>
  );
}
```

## Compose

Rules:

- Compose the parts (`compose-parts`): Build each item from its named parts as children, and pass your text and icons in as parts.
- Every state is designed (`every-state`): Give each view of data its loading, empty, and error states: a skeleton in the final layout, an `Empty` with an illustration and one next action, and an error that says what failed and how to retry.

## Add it

```bash
npx shadcn@latest add @gelatin-ui/text-typewriter
```

It adds 29 registry items: 28 files, 4601 lines, and the npm packages `@base-ui/react`, `@mantine/hooks`, `@xstate/react`, `clsx`, `motion`, `tailwind-merge`, `xstate`.

## For AI agents

- Every item, one file: https://gelatinui.com/llms.txt
- MCP server (`search_items`, `get_item`, `get_install_plan`): https://gelatinui.com/mcp

## Related

- [Text Streaming](https://gelatinui.com/components/text-streaming.md)
- [Text Scramble](https://gelatinui.com/components/text-scramble.md)
- [Count Up](https://gelatinui.com/components/count-up.md)
- [Typography](https://gelatinui.com/components/typography.md)
- [Search Field](https://gelatinui.com/components/search-field.md)

## Motion

| Part | Motion |
| --- | --- |
| Type | progress · 50ms a letter · linear · each key shows its letter; the caret holds still |
| Erase | progress · 30ms a letter · linear · the letters go from the end; `word` takes a word every 150ms |
| Select all | none · the full text shows as selected for 600ms with no caret, then goes at once |
| Caret | none · while it waits the caret blinks on a 1s loop, half on and half off; it stops off screen |
