Agent chat
ConversationA composable agent conversation with a bounded thread, draft composer, attachments, progress, explicit permissions and choice prompts.
Try it
Open the full agent workspace example →
Add to your project
npx shadcn@latest add https://luv-jeri.github.io/cojeev-ui/r/agent-chat.jsonThe command includes the component’s shared dependencies. Your project keeps editable source files.
Include the complete example
This example also composes button, presence, agent-state. Install its parts together:
npx shadcn@latest add https://luv-jeri.github.io/cojeev-ui/r/button.json https://luv-jeri.github.io/cojeev-ui/r/presence.json https://luv-jeri.github.io/cojeev-ui/r/agent-state.json https://luv-jeri.github.io/cojeev-ui/r/agent-chat.jsonUsing agent chat
Compose AgentChatHeader, AgentChatThread and AgentChatComposer inside AgentChat.
Keep messages, draft, selected files and request status in your application. Clear a draft only after onSend accepts it.
Use AgentChatPermission for deliberate allow/deny decisions. Render its receipt after a decision.
Use AgentChatOptions to collect one valid choice; Continue remains disabled until a valid enabled option is selected.
The documentation runs a local simulation. Connect callbacks to your own application to perform real work.
API
Compose the exported parts below. The prop types are read from the React source during the registry build.
Native element or underlying primitive props are inherited where declared, including accessible labels, event handlers and refs.
AgentChatLayoutProps
Accepts the native or primitive props declared by its exported TypeScript type.
AgentChatMainProps
Accepts the native or primitive props declared by its exported TypeScript type.
AgentChatAsideProps
Accepts the native or primitive props declared by its exported TypeScript type.
AgentChatProps
Accepts the native or primitive props declared by its exported TypeScript type.
AgentChatHeaderProps
| Prop | Type | Required |
|---|---|---|
title | React.ReactNode | No |
description | React.ReactNode | No |
status | AgentStatus | No |
statusLabel | string | No |
actions | React.ReactNode | No |
AgentChatThreadProps
| Prop | Type | Required |
|---|---|---|
jumpLabel | string | No |
AgentChatMessageProps
| Prop | Type | Required |
|---|---|---|
author | string | No |
avatar | React.ReactNode | No |
from | "agent" | "user" | No |
meta | React.ReactNode | No |
actions | React.ReactNode | No |
AgentChatComposerProps
| Prop | Type | Required |
|---|---|---|
value | string | Yes |
onValueChange | (value: string) => void | Yes |
onSend | () => void | Yes |
status | AgentStatus | No |
onStop | () => void | No |
attachments | readonly AgentChatAttachment[] | No |
onAttach | (files: File[]) => void | No |
onRemoveAttachment | (id: string) => void | No |
accept | string | No |
disabled | boolean | No |
placeholder | string | No |
label | string | No |
hint | React.ReactNode | No |
error | React.ReactNode | No |
onRetry | () => void | No |
maxLength | number | No |
AgentChatPermissionProps
| Prop | Type | Required |
|---|---|---|
title | React.ReactNode | Yes |
description | React.ReactNode | Yes |
scope | React.ReactNode | No |
decision | "pending" | "allowed" | "denied" | No |
onDecision | (decision: "allowed" | "denied") => void | Yes |
disabled | boolean | No |
allowLabel | string | No |
denyLabel | string | No |
AgentChatOptionsProps
| Prop | Type | Required |
|---|---|---|
title | string | Yes |
options | readonly AgentChatOption[] | Yes |
value | string | No |
onValueChange | (value: string) => void | Yes |
onConfirm | (value: string) => void | Yes |
disabled | boolean | No |
confirmLabel | string | No |
AgentChatProgressProps
| Prop | Type | Required |
|---|---|---|
steps | readonly AgentChatStep[] | Yes |
Accessibility
The thread is a keyboard-reachable live log and follows only while the reader stays near its end.
Enter inserts a new line. Command/Ctrl+Enter sends. Stop preserves the conversation.
Label attachments and permission scope clearly. Do not treat a preset option as submitted consent.
Return focus to the next useful control after a request resolves or is cancelled.
States and appearance
For conditional content, keep a MotionPresence boundary around keyed MotionSurface children. The shared entrance and exit states work with native primitives and respect your motion preference.
Try pointer and keyboard interaction, and switch the appearance control in the navigation to compare light and dark mode. Motion respects reduced motion preferences.