Skip to main content

Configuration reference

There are two configuration objects. Both are JSON-Schema-validated.

ObjectSet viaSchemaSource of truth
ChativaSettingswindow.chativaSettings (before mount)schemas/chativa-settings.schema.jsonapplication/ChativaSettings.ts
ThemeConfigchatStore.getState().setTheme(...) (any time)schemas/theme.schema.jsondomain/value-objects/Theme.ts

ChativaSettings.theme is a deep partial of ThemeConfig — anything you pass is merged over DEFAULT_THEME.

Schema drift guard. The ThemeConfig ↔ schema contract is enforced by schema-drift.test.ts. Any field added to the TypeScript type without a matching schema update fails CI. See schemas/README.md and AGENTS.md → Schema sync.

ChativaSettings

interface ChativaSettings {
connector?: string | IConnector;
theme?: DeepPartial<ThemeConfig>;
locale?: string; // BCP-47, e.g. "tr"
i18n?: Record<string, unknown>;
}

Set it before <chat-iva> is connected:

<script>
window.chativaSettings = {
connector: "directline",
theme: { colors: { primary: "#1B1464" } },
locale: "tr",
i18n: { all: { header: { title: "Sanal Asistan" } } },
};
</script>
<script type="module" src="..."></script>
<chat-iva></chat-iva>

applyGlobalSettings() runs once per page; later mutations to window.chativaSettings are ignored.

i18n shape — two formats

Per-language (recommended) — the all key applies to every language; other keys are locale codes:

i18n: {
all: { header: { title: "Bot" } },
tr: { header: { title: "Botum" } },
}

Flat (backwards compatible) — applied to every registered language:

i18n: { header: { title: "Bot" } }

ThemeConfig

Full reference (all fields, defaults, enums, and constraints) lives in the schema: schemas/theme.schema.json. Highlights:

FieldTypeDefaultNotes
colors.primary/secondary/background/text/borderstringbrand defaultsAny CSS color.
positionbottom-right | bottom-left | top-right | top-leftbottom-rightLauncher corner.
positionMargin"1""5""2"Edge margin (~0.5rem per step).
sizesmall | medium | largemediumLauncher button diameter (44/56/68 px).
layout.width/height/maxWidth/maxHeightstring360px / 520px / 100% / 100%Panel sizing.
layout.horizontalSpace / verticalSpace"1""5""2"Panel ↔ viewport / panel ↔ button gaps.
windowModepopup | side-panel | fullscreen | inlinepopupPresentation style. See theming → Window modes.
allowFullscreenbooleantrueShow fullscreen toggle in the header.
showMessageStatusbooleantrueTick indicators on user messages.
enableSearchbooleantrueHeader search button.
enableMultiConversationbooleanfalseConversation list view. Requires connector hooks. See multi-conversation.
enableFileUploadbooleantrueAttach button — also requires connector.sendFile.
hideButtonOnOpenbooleanfalseFor slotted custom launchers.
avatar.{bot,user,header,showBot,showUser}string | booleandefaultsAvatars.
endOfConversationSurveyobjectenabledSee survey.

Setting at runtime

import { chatStore } from "@chativa/core";

chatStore.getState().setTheme({
colors: { primary: "#0ea5e9" },
windowMode: "side-panel",
enableSearch: false,
});

setTheme() accepts DeepPartial<ThemeConfig> — only the keys you pass are overridden via mergeTheme().

Or use the fluent builder

import { ThemeBuilder } from "@chativa/core";

const theme = ThemeBuilder.create()
.setPrimary("#0ea5e9")
.setPosition("bottom-left")
.setSize("large")
.setLayout({ width: "400px", height: "600px" })
.setShowMessageStatus(true)
.build();

chatStore.getState().setTheme(theme);