Chat

Chat UI component and customization

Chat Package

Pre-built chat UI component with full customization support.

npm install @yourgpt/copilot-sdk-chat

CopilotChat

The main chat component.

import { CopilotChat } from '@yourgpt/copilot-sdk-chat';

<CopilotChat
  title="AI Assistant"
  placeholder="Ask anything..."
  suggestions={['Help me', 'Search']}
  className="h-full"
/>

Props

PropTypeDefaultDescription
titlestring"AI Assistant"Header title
placeholderstring"Type a message..."Input placeholder
suggestionsstring[][]Quick action buttons
classNamestring-Additional CSS classes
toolRenderersRecord<string, Component>{}Custom tool result renderers
attachmentsEnabledbooleanfalseEnable file attachments
voiceEnabledbooleanfalseEnable voice input

toolRenderers

Render custom UI for tool results:

<CopilotChat
  toolRenderers={{
    weather: ({ result, status }) => (
      <WeatherCard data={result} loading={status === 'executing'} />
    ),
    chart: ({ result }) => (
      <BarChart data={result.data} />
    ),
  }}
/>

ToolRendererProps

interface ToolRendererProps<T = unknown> {
  name: string;
  args: Record<string, unknown>;
  result: T;
  status: 'pending' | 'executing' | 'completed' | 'error';
  error?: string;
}

Theming

<CopilotChat
  theme={{
    mode: 'dark',
    primaryColor: '#6366f1',
    backgroundColor: '#1f2937',
    borderRadius: '12px',
  }}
/>

Custom Styling

<CopilotChat
  classNames={{
    container: 'my-container',
    header: 'my-header',
    messages: 'my-messages',
    input: 'my-input',
  }}
/>

On this page