Compose primitivesToolPill
Tool Pill
Text pill for composer toggles such as web search, deep think, or tools.
ToolPill ships with a full API table, a copyable example, and accessibility notes.
tsx
Installation
Install the package once, then import ToolPill from its direct entry point or from the root.
bash
pnpm add @agent-ui/reacttsx
import { ToolPill } from "@agent-ui/react";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 { ToolPill } from "@agent-ui/react"; <ToolPill label="Toggle web search" active={web} icon={<Search />}>Search</ToolPill>API reference
Every prop ToolPill accepts, its type, default, and behaviour.
| Name | Type | Default | Description |
|---|---|---|---|
| label | string | — | Accessible name. |
| active | boolean | false | Pressed styling and aria-pressed. |
| icon | ReactNode | — | Optional leading icon. |
| className | string | — | Merged with the pill recipe. |
Use it with the rest of the library
ToolPill 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