Button
Button is the shared action primitive across Agent UI. It ships the same class-variance-authority recipe used by the chat surfaces, so docs previews and production UIs stay consistent. Use asChild to render a link or another element while keeping button styling.
Button ships with a full API table, a copyable example, and accessibility notes.
Installation
Install the package once, then import Button from its direct entry point or from the root.
pnpm add @agent-ui/reactimport { Button } from "@agent-ui/react/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.
import { Button } from "@agent-ui/react"; <Button>Send</Button><Button variant="outline" size="sm">Cancel</Button><Button variant="destructive">Delete chat</Button>API reference
Every prop Button accepts, its type, default, and behaviour.
| Name | Type | Default | Description |
|---|---|---|---|
| variant | "default" | "destructive" | "outline" | "secondary" | "ghost" | "link" | "default" | Visual style. |
| size | "default" | "sm" | "lg" | "icon" | "default" | Control height and padding. |
| asChild | boolean | false | Render the child element via Radix Slot instead of a button. |
| disabled | boolean | false | Native disabled state; also lowers opacity. |
| className | string | — | Tailwind classes merged with the variant recipe. |
Accessibility
Button composes with MessageList, ChatShell, useChat, and the provider compose blocks. Browse the full reference or see all components in the gallery.
5 lines · copy-ready