claudius-chat-widget
    Preparing search index...

    Interface ChatWidgetProps

    Props for the ChatWidget component.

    interface ChatWidgetProps {
        accentColor?: string;
        apiUrl: string;
        attachments?: boolean | AttachmentsOptions;
        conversationExport?: boolean;
        locale?: LocaleCode;
        persistMessages?: boolean;
        placeholder?: string;
        plugins?: ClaudiusPlugin[];
        position?: WidgetPosition;
        requestTimeoutMs?: number;
        storageKeyPrefix?: string;
        streaming?: boolean;
        subtitle?: string;
        theme?: ClaudiusThemeInput;
        title?: string;
        translations?: Partial<ClaudiusTranslations>;
        triggers?: Trigger[];
        voice?: boolean | VoiceOptions;
        welcomeMessage?: string;
    }
    Index

    Properties

    accentColor?: string

    Accent color override; wins over the theme's accent in both light and dark.

    apiUrl: string

    Absolute URL of the Worker chat endpoint (e.g. https://api.example.com).

    attachments?: boolean | AttachmentsOptions

    Let visitors attach images and PDFs (click, drag-and-drop, or paste). true enables the defaults (5 MB per file, 5 files per message, JPEG / PNG / GIF / WebP / PDF); pass an AttachmentsOptions to tune them. The worker must allow attachments too (it does by default).

    false

    conversationExport?: boolean

    Let visitors copy the conversation as Markdown, or download it as Markdown or JSON, from a menu in the chat header. Everything happens in the browser and nothing is sent to the Worker. Only the literal true enables it. See the Conversation export guide.

    false

    locale?: LocaleCode

    BCP-47 locale used to select built-in translations.

    persistMessages?: boolean

    Persist the conversation to storage so it survives reloads.

    false

    placeholder?: string

    Placeholder text for the message input.

    plugins?: ClaudiusPlugin[]

    Middleware run around each message: onBeforeSend, onAfterReceive, and onError. Hooks run in array order and may modify, replace, or short-circuit messages. See ClaudiusPlugin.

    position?: WidgetPosition

    Corner of the viewport the widget docks to.

    "bottom-right"

    requestTimeoutMs?: number

    Abort a chat request after this many milliseconds.

    storageKeyPrefix?: string

    Prefix for the storage key used when ChatWidgetProps.persistMessages is enabled.

    streaming?: boolean

    Stream assistant replies token-by-token from the Worker's SSE endpoint, with automatic fallback to the non-streaming API on older browsers or Workers without /api/chat/stream. Set to false to always use the blocking request/response flow.

    true

    subtitle?: string

    Header subtitle shown beneath the title.

    Color-scheme mode ("light" | "dark" | "auto"), a built-in theme name ("default" | "minimal" | "playful" | "corporate"), an inline ClaudiusTheme object, or a URL to a theme JSON file.

    "light"

    title?: string

    Header title. Falls back to the active locale's default title.

    translations?: Partial<ClaudiusTranslations>

    Partial overrides merged over the resolved locale translations.

    triggers?: Trigger[]

    Proactive open/greeting rules evaluated against the current page.

    voice?: boolean | VoiceOptions

    Voice features built on the browser's Web Speech API: a mic button for dictating messages and a read-aloud control on assistant replies. true enables both (click-to-toggle mic, no auto-submit); pass a VoiceOptions to choose hold-to-talk, auto-submit, a language, or to switch either half off. Each half renders only where the browser supports it. The widget never handles audio itself, but the browser's speech service may process it remotely; see the Voice guide.

    false

    welcomeMessage?: string

    First assistant message shown when the chat opens.