# Typewriter

Character-by-character text reveal with a deterministic blinking cursor.

> For the complete documentation index, see [llms.txt](/llms.txt). Markdown variants are available by appending `.md` to any URL or sending an `Accept: text/markdown` header. An agent skill is available at [/.well-known/agent-skills/site-skill.md](/.well-known/agent-skills/site-skill.md).

## Installation

<TabsTrigger value="cli">Command</TabsTrigger>
<TabsTrigger value="manual">Manual</TabsTrigger>

```bash
npx shadcn@latest add @framecn/typewriter
```

<Step>Copy and paste the following code into your project.</Step>

<Step>Update the import paths to match your project setup.</Step>

## Usage

```tsx
import { Typewriter } from "@/components/framecn/typewriter";
```

```tsx
<Typewriter />
```

## API Reference

### Typewriter

| Prop               | Type      | Default                         |
| ------------------ | --------- | ------------------------------- |
| `text`             | `string`  | `"console.log('hello, world')"` |
| `cursor`           | `boolean` | `true`                          |
| `charsPerSecond`   | `number`  | `20`                            |
| `speed`            | `number`  | `1`                             |
| `fontSize`         | `number`  | `48`                            |
| `color`            | `string`  | `"#171717"`                     |
| `cursorColor`      | `string`  | `"#171717"`                     |
| `fontWeight`       | `number`  | `600`                           |
| `className`        | `string`  | `-`                             |
| `fps`              | `number`  | `30`                            |
| `durationInFrames` | `number`  | `120`                           |
| `width`            | `number`  | `1000`                          |
| `height`           | `number`  | `500`                           |
| `background`       | `string`  | `"white"`                       |

## Notes

  The cursor uses a deterministic blink pattern that toggles visibility every
  frame. For a faster blink rate, decrease FPS or use a custom cursor
  implementation.

  The typewriter requires the `text` prop to be a string. If you need to type
  JSX elements, consider using a separate typewriter component for each element.