跳至主要内容

主題

透過 theme prop 客製化聊天機器人的外觀。預設主題中的每一個顏色、 間距、圓角都可以被覆寫。

預設主題

目前主題設定

{}
聊天機器人載入中…
提示

試試看 Crazy preset,一次看到所有主題 slot 的效果。

程式範例

import { Chatbot, ChatbotTheme } from "@asgard-js/react";

const myTheme: ChatbotTheme = {
chatbot: {
backgroundColor: "#3c1d3b",
borderColor: "#92ff8c",
primaryComponent: {
mainColor: "#ff0000",
secondaryColor: "#aba400",
},
},
botMessage: {
color: "#00f0ff",
backgroundColor: "#ff7a00",
},
userMessage: {
color: "#522801",
backgroundColor: "#060081",
},
};

<Chatbot theme={myTheme} {...rest} />;

Theme 結構

層級欄位說明
chatbotbackgroundColor, borderColor, borderRadius外框樣式
chatbotcontentMaxWidth, width, height尺寸控制
chatbotmainColor, secondaryColor, inactiveColor全域色彩
chatbot.primaryComponentmainColor, secondaryColor主要互動元素色彩
chatbot.headerstyle, title.style, actionButton.styleHeader 樣式
chatbot.bodystyle訊息區域樣式
chatbot.footerstyle, textArea.style, submitButton.style, speechInputButton.style輸入區域樣式
botMessagecolor, backgroundColor, linkColor, quickReplyBackgroundColorBot 訊息氣泡
userMessagecolor, backgroundColor使用者訊息氣泡
templatequickReplies.style, references.style, time.style模板元素樣式