# Erase wipe

Clearing the composer as wiping a board: an eraser sweeps back and the words vanish behind it.

Also called: clear input animation, eraser animation.

Example: Clearing as wiping a board. Clear the composer and an eraser sweeps from the end of the text back to the start, the words disappearing behind it. Preview: https://chatcn.dev/preview/erase-wipe-demo

A small eraser enters at the end of the text and sweeps back to the start, and the words disappear behind it as it passes; at the start it lifts away and the field is empty. Long drafts take a little longer, never more than half a second. It is a function, so it works on any field you already have.

## Installation

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

## Usage

```tsx
import { eraseWipe } from "@/components/ui/chatcn/erase-wipe"

<button onClick={() => eraseWipe({ field: inputRef.current, onCleared: () => setValue("") })}>Clear</button>
```

## Props

| Prop | Type | Notes |
| --- | --- | --- |
| `field` | `HTMLElement` | The input or textarea |
| `onCleared` | `() => void` | Clear the value here; runs once the eraser has passed |
| `duration` | `number` | Default scales with the text, 280 to 520 ms |

## Accessibility

- The eraser is decorative and hidden; focus stays in the field.

## Motion

- A `clip-path` wipe on the field and the eraser share one keyframe easing. Reduced motion: the field just clears.

Source: https://chatcn.dev/docs/components/erase-wipe