PrimitivesStopButton
Stop Button
Abort control that appears while a response is streaming.
StopButton ships with a full API table, a copyable example, and accessibility notes.
tsx
Installation
Install the package once, then import StopButton from its direct entry point or from the root.
bash
pnpm add @agent-ui/reacttsx
import { StopButton } from "@agent-ui/react/stop-button";Tailwind CSS v4 users: add @source "../node_modules/@agent-ui/react/src" to the global stylesheet so the library utilities are generated.
Usage
The example below is the same code that renders the preview. Copy it, swap in your own handlers, and ship.
tsx
import { StopButton } from "@agent-ui/react"; {isStreaming && <StopButton onStop={stop} />}API reference
Every prop StopButton accepts, its type, default, and behaviour.
| Name | Type | Default | Description |
|---|---|---|---|
| onStop | () => void | — | Called when the user aborts. |
| className | string | — | Merged with the button styles. |
Accessibility
Labelled Stop generating; remains keyboard focusable while visible.
Use it with the rest of the library
StopButton composes with MessageList, ChatShell, useChat, and the provider compose blocks. Browse the full reference or see all components in the gallery.
3 lines · copy-ready