HomeBlocksAI Chat Block

AI Chat Block

Paid

A complete conversational interface with threads, messages, and composer controls.

Tweaker

Adjust the live block preview.

30

Installation

Install automatically via CLI or manually integrate dependencies and code.

The install command is available with paid source access.

Usage

Import the component and configure visual variants, sizes, and operational states.

import { AiChatBlock } from '@/components/blocks/ai-chat'
 
<AiChatBlock
title="Agent Chat"
userName="CJ"
userAvatar={<img src="/assets/images/cj1.jpg" alt="" className="size-full object-cover" />}
placeholder="Ask the agent…"
onSend={async ({ message }) => getAssistantReply(message)}
/>

Composition

Compose with icons, form triggers, and layout containers.

import AiChatBlock from '@/components/blocks/ai-chat/ai-chat-block'
 
export function ChatSection() {
return (
<section className="h-dvh bg-background p-4">
<AiChatBlock className="h-full min-h-0" />
</section>
)
}

API Reference

Property matrix, types, defaults, and usage descriptions.

PropTypeDefaultDescription
placeholderstringAsk the agent…Composer placeholder text.
userName / userAvatarstring / ReactNodeUUser identity shown beside sent messages.
autoPlaybooleantrueAutomatically plays the thinking trace.
workingLabelstringWorkingLabel shown while the trace is active.
streamSpeednumber30Streaming answer speed passed to the markdown stream.
onSend(request: ChatRequest) => ChatResponsesample runOptional answer callback for custom responses.
onRun(prompt, payload) => AgentChatRunResultbuilt-in tracesOptional callback for custom trace nodes and answers.
classNamestringundefinedLayout classes for the block shell.

Data Attributes

State-reflecting DOM attributes for custom selector styling.

AttributeValuesDescription
aria-expanded
truefalse
Thinking trace disclosure state.
aria-pressed
truefalse
Dictation button state when enabled.
role="group"mode pickerPlan/Agent mode switcher group.

How It Works

AiChatBlock composes AiChatInput, ThinkingState, and StreamedMarkdown into a single conversational surface. Sending a prompt creates a run, plays a mode-aware tool trace, then streams a markdown answer. Plan mode limits the trace to reasoning and inspection nodes; Agent mode adds patch and terminal nodes.

Accessibility

The composer, mode switcher, trace disclosure, and streamed answer are keyboard reachable. Reduced motion is respected by the underlying motion components.

Keyboard Navigation
EnterSend the composer message.
Shift + EnterInsert a newline in the composer.
Tab / arrowsMove through composer menus and mode options.

Limitations

•Built-in traces are deterministic samples; connect onSend or onRun for live model output.
•Image previews use object URLs for the current session.

Features

•Plan and Agent modes
•Web search trace with sources
•Image and file attachments
•Markdown streamed answers
•Auto-scrolling transcript
•User avatar and message alignment
Credits

Meet the team behind the block

Crafted for modern web applications and AI agent workflows.

Aryan

Aryan

@istmX

Building high-performance interfaces, developer tooling, and autonomous agent workflows.

Helped by
Ella

Ella

UI/UX Designer

Crafting beautiful experiences.

Kenji

Kenji

WebGL & Shader Designer

Bringing visuals to life.

Sarah

Sarah

Motion Designer

Animating the details.