# Auto title

A chat that names itself in front of you, written in behind the kit's square caret.

Also called: typing title, chat title animation.

Example: A chat that names itself. When the generated title arrives, New chat steps back and the title is written in behind the kit's square caret. Preview: https://chatcn.dev/preview/auto-title-demo

When the generated title arrives, the placeholder steps back and the new title is written in from the start, with the kit's square caret leading the line like the pen that is writing it; then the caret lifts away. Renaming by hand later writes the same way. One line, no layout jump: the box takes the new width as it is written.

## Installation

```bash
npx shadcn@latest add https://chatcn.dev/r/auto-title.json
```

## Usage

```tsx
import { AutoTitle } from "@/components/ui/chatcn/auto-title"

<AutoTitle title={chat.title ?? ""} placeholder="New chat" />
```

## Props

| Prop | Type | Notes |
| --- | --- | --- |
| `title` | `string` | Changing it writes the new one in |
| `placeholder` | `string` | Default "New chat" |

## Accessibility

- The title is announced once, politely, when it changes; the caret is hidden from screen readers.

## Motion

- A linear `clip-path` reveal with the caret on the same timing, about 40 ms a letter. Reduced motion: it swaps.

Source: https://chatcn.dev/docs/components/auto-title