Chat Components

    React component props reference for @cadraos/sdk/chat.

    AgentChat

    All-in-one chat component. The primary way to embed agent conversations.

    PropTypeDescription
    agentIdstringAgent UUID to chat with
    teamIdstringTeam UUID (alternative to agentId)
    sessionIdstringResume an existing session
    adapterChatAdapterCustom backend adapter
    enableAttachmentsbooleanEnable file upload support
    showToolCallsbooleanShow tool call details in messages
    welcomeMessagestring | ReactNodeInitial greeting message
    placeholderstringInput placeholder text
    onSessionCreated(id: string) => voidCallback when session starts
    onError(error) => voidError handler callback
    onImageClick(url: string) => voidImage click handler
    componentsMarkdownComponentsCustom markdown renderers
    classNamestringCSS class for container

    ChatConfigProvider

    Context provider for shared chat configuration.

    tsx
    import { ChatConfigProvider, AgentChat } from '@cadraos/sdk/chat';
    
    <ChatConfigProvider
      apiBaseUrl="https://api.example.com"
      tokenProvider={async () => await getToken()}
      orgId={123}
    >
      <AgentChat agentId="agent-uuid" />
    </ChatConfigProvider>

    MessageList

    Renders a list of chat messages with auto-scroll.

    tsx
    <MessageList
      messages={messages}
      isLoading={isStreaming}
      showToolCalls
      onImageClick={(url) => openLightbox(url)}
    />

    ChatInput

    Message input with auto-resize, file attachments, and submit handling.

    tsx
    <ChatInput
      onSend={(message) => handleSend(message)}
      placeholder="Ask anything..."
      disabled={isStreaming}
      enableAttachments
    />

    MarkdownContent

    Renders markdown with syntax highlighting, tables, code blocks, and custom components.

    tsx
    <MarkdownContent
      content={markdownString}
      components={{
        a: ({ href, children }) => <CustomLink href={href}>{children}</CustomLink>,
        img: ({ src, alt }) => <ZoomableImage src={src} alt={alt} />,
      }}
      urlTransform={(url) => proxyUrl(url)}
      contentTransform={(md) => md.replace(/\[artifact\]/g, '')}
    />

    FileDropZone

    Drag-and-drop zone for file uploads. Works with useFileAttachments.

    tsx
    <FileDropZone {...attachments.dropZoneProps}>
      <div>Drop files here or click to upload</div>
    </FileDropZone>

    ToolCallEntry

    Displays tool call details including name, input, output, and images extracted from results.

    tsx
    <ToolCallEntry
      toolCall={toolCall}
      defaultExpanded={false} // images always visible
    />