# Stop snap

The end of a stopped answer, marked by what stopped it: the Stop button's square arcs to the end of the text and settles as the end mark.

Also called: stop button animation.

> 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: Stop lands where it stopped. Press Stop mid answer: the square on the button arcs to the end of the text, lands on the caret and settles as a gray end mark with Stopped written after it. Preview: https://chatcn.dev/preview/stop-snap-demo

While an answer streams this is the kit's square caret. Press Stop and the square on the Stop button lifts off, arcs to where the text broke off and lands on the caret with a small squash, then settles into a quiet gray end mark, with Stopped written in after it. The square that means writing, press to stop ends as the full stop of the answer it stopped. An answer that finishes on its own simply loses its caret.

## Installation

```bash
npx shadcn@latest add @chatcn-pro/stop-snap
```

## Usage

```tsx
import { StopSnap } from "@/components/ui/chatcn/pro/stop-snap"

<p>
  {text}
  <StopSnap status={status} from={stopButtonRef} detail="214 tokens" />
</p>
```

Put `data-stop-square` on the square inside your Stop button so the flight starts exactly there; without it the flight starts from the button's centre.

## Props

| Prop | Type | Notes |
| --- | --- | --- |
| `status` | `"streaming" | "stopped" | "done"` | Done removes it |
| `from` | `RefObject<HTMLElement>` | The Stop button |
| `label` | `string` | Default "Stopped" |
| `detail` | `string` | After the label, such as a token count |

## Accessibility

- The Stopped note is a status, so a screen reader hears that the answer was cut short.
- The caret and the flying square are `aria-hidden`.

## Motion

- One 520 ms arc with a quarter turn, sampled into keyframes; the landing squash is 300 ms; the note is revealed with `clip-path`.
- Reduced motion: no flight, the note fades in.

Source: https://chatcn.dev/docs/components/stop-snap