# Gen cancel

Cancelling an image generation, shown as the half made image freezing where it got to.

Also called: cancel generation.

> chatcn Pro: needs a Pro license (https://chatcn.dev/pro). Install from the `@chatcn-pro` registry with your license token; setup at https://chatcn.dev/docs/chatcn-pro.

Example: Cancel, and the image gives up. While it generates, the picture clears out of coloured noise. Cancel, and the half formed image slips back a step and freezes, its colour draining, with how far it got. Preview: https://chatcn.dev/preview/gen-cancel-demo

While it generates, the picture clears out of coloured noise as the steps land. Cancel, and the half formed image slips back a step into the grain and freezes there, its colour draining, while the card says how far it got with a way to try again. Finishing clears the last of the grain.

## Installation

```bash
npx shadcn@latest add @chatcn-pro/gen-cancel
```

## Usage

```tsx
import { GenCancel } from "@/components/ui/chatcn/pro/gen-cancel"

<GenCancel status={status} progress={progress} onCancel={cancel} onRetry={retry} prompt={prompt} />
```

The demo paints its picture from your theme's colours on a canvas. In your app, draw your real preview into the same pipeline, or use it as the waiting state.

## Props

| Prop | Type | Notes |
| --- | --- | --- |
| `status` | `"generating" | "done" | "cancelled"` |  |
| `progress` | `number` | 0 to 1 |
| `onCancel` / `onRetry` | `() => void` |  |
| `prompt` | `string` | For the image's name |

## Accessibility

- The canvas is an image named with the prompt and progress; the status line is polite.

## Motion

- Noise and blur follow progress through an eased follower; cancelling runs it back faster. Reduced motion: it jumps to each state.

Source: https://chatcn.dev/docs/components/gen-cancel