Skip to content
Agent UI
BlocksAgentCommandPalette

AgentCommandPalette

Searchable native command dialog with an action callback. Import from @agent-ui/react or a direct subpath. Tailwind CSS v4 theme tokens are required.

AgentCommandPalette ships with a full API table, a copyable example, and accessibility notes.

tsx

No command selected

Installation

Install the package once, then import AgentCommandPalette from its direct entry point or from the root.

bash
pnpm add @agent-ui/react
tsx
import { AgentCommandPalette } from "@agent-ui/react/blocks/command-palette";

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 { AgentCommandPalette } from "@agent-ui/react";
 
<AgentCommandPalette open={open} commands={commands} onOpenChange={setOpen} onSelect={run} />

API reference

Every prop AgentCommandPalette accepts, its type, default, and behaviour.

API reference for this component
NameTypeDefaultDescription
openReact prop—Configuration exposed through the component's public React props.
commandsReact prop—Configuration exposed through the component's public React props.
onOpenChangecallback—Configuration exposed through the component's public React props.
onSelect(command: AgentCommand) => void—Selected command callback.

Accessibility

Provide explicit action authorization and accessible labels when composing the block.
Use it with the rest of the library

AgentCommandPalette 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