Code
Inline code with a muted background that matches prose and tables.
Code ships with a full API table, a copyable example, and accessibility notes.
Run pnpm add @agent-ui/react to install the library.
Installation
Install the package once, then import Code from its direct entry point or from the root.
pnpm add @agent-ui/reactimport { Code } from "@agent-ui/react/code";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 { Code } from "@agent-ui/react"; <p>Run <Code>pnpm add @agent-ui/react</Code> to install.</p>API reference
Every prop Code accepts, its type, default, and behaviour.
| Name | Type | Default | Description |
|---|---|---|---|
| children | ReactNode | — | Code text or inline markup. |
| className | string | — | Merged with the inline code recipe. |
Code 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