Styling Reference Complete reference for customizing colors, fonts, and layout
The chat widget can be customized using style props, CSS variables, or class names.
Pass a styles object to configure the widget appearance programmatically.
< ChatWidget
styles = {{
theme: 'auto' ,
primaryColor: '#3b82f6' ,
// ... other options
}}
/>
Property Type Default Description theme'auto' | 'light' | 'dark''auto'Theme mode. auto follows the host app or system preference primaryColorstring#3b82f6Primary brand color (header, buttons, user bubbles) primaryTextColorstring#ffffffText color on primary-colored elements backgroundColorstring#ffffffMain background color borderColorstring#e5e7ebBorder color for container and inputs headerTextColorstring#ffffffHeader title text color userBubbleTextColorstring#ffffffText color in user message bubbles assistantBubbleBackgroundstringtransparentBackground for assistant message bubbles assistantBubbleTextColorstring#111827Text color in assistant message bubbles fontFamilystring'Inter', system-ui, sans-serifFont family for all text borderRadiusstring0.75remBorder radius for container and bubbles inputBackgroundstring#ffffffBackground color for input area inputTextColorstring#111827Text color in input field inputPlaceholderColorstring#6b7280Placeholder text color thoughtsBorderColorstring#d1d5dbBorder color for expandable thoughts section
By default, the widget uses:
styles = {{ theme : 'auto' }}
In auto mode, the widget detects the host page theme in this order:
data-theme="dark" or data-theme="light" on <html> or <body>
.dark or .light class on <html> or <body>
CSS color-scheme
the user's prefers-color-scheme system setting
You can force a specific mode:
< ChatWidget
styles = {{ theme: 'dark' }}
/>
< ChatWidget
styles = {{ theme: 'light' }}
/>
Theme mode chooses the built-in light or dark color set. Any other values in styles override the
selected theme, so you can use automatic dark mode and still customize brand colors:
< ChatWidget
styles = {{
theme: 'auto' ,
primaryColor: '#6366f1' ,
borderRadius: '1rem' ,
}}
/>
< ChatWidget
styles = {{
theme: 'auto' ,
// Brand colors
primaryColor: '#6366f1' ,
primaryTextColor: '#ffffff' ,
// Container
backgroundColor: '#ffffff' ,
borderColor: '#e5e7eb' ,
borderRadius: '1rem' ,
// Header
headerTextColor: '#ffffff' ,
// Messages
userBubbleTextColor: '#ffffff' ,
assistantBubbleBackground: '#f3f4f6' ,
assistantBubbleTextColor: '#111827' ,
// Input
inputBackground: '#ffffff' ,
inputTextColor: '#111827' ,
inputPlaceholderColor: '#9ca3af' ,
// Typography
fontFamily: "'Roboto', system-ui, sans-serif" ,
// Other
thoughtsBorderColor: '#e5e7eb' ,
}}
/>
Override styles globally using CSS custom properties on [data-chat-widget].
Variable Default Description --chat-primary#3b82f6Primary brand color --chat-primary-text#ffffffText on primary color --chat-primary-hover#2563ebHover state for primary (auto-generated) --chat-background#ffffffMain background --chat-border#e5e7ebBorder color
Variable Default Description --chat-font-family'Inter', system-ui, ...Font family --chat-font-size0.925remBase font size for messages --chat-thought-font-size0.75remFont size for thoughts section --chat-radius0.75remBase border radius
Variable Default Description --chat-header-text#ffffffHeader title color --chat-user-text#ffffffUser bubble text color --chat-assistant-bgtransparentAssistant bubble background --chat-assistant-text#111827Assistant bubble text color --chat-thought-border#d1d5dbThoughts section border
Variable Default Description --chat-input-bg#ffffffInput area background --chat-input-text#111827Input text color --chat-input-placeholder#6b7280Placeholder color
[ data-chat-widget ] {
--chat-primary : #8b5cf6 ;
--chat-primary-hover : #7c3aed ;
--chat-background : #fafafa ;
--chat-border : #e5e7eb ;
--chat-font-family : 'Poppins' , sans-serif ;
--chat-radius : 1 rem ;
/* Messages */
--chat-assistant-bg : #f3f4f6 ;
--chat-assistant-text : #1f2937 ;
/* Input */
--chat-input-bg : #ffffff ;
--chat-input-text : #1f2937 ;
}
BEM-style class names for targeted CSS customization.
Class Description .chat-widgetRoot container .chat-widget__headerHeader bar .chat-widget__titleHeader title text .chat-widget__messagesScrollable message area
Class Description .chat-widget__messageMessage wrapper .chat-widget__message-rowMessage row container .chat-widget__message-row--userUser message row (right-aligned) .chat-widget__message-row--assistantAssistant message row (left-aligned) .chat-widget__bubbleMessage bubble base .chat-widget__bubble--userUser message bubble .chat-widget__bubble--assistantAssistant message bubble .chat-widget__markdownMarkdown content wrapper .chat-widget__widgetCustom widget container
Class Description .chat-widget__thoughtsThoughts container .chat-widget__detailsExpandable details element .chat-widget__thoughts-summaryClickable summary row .chat-widget__thoughts-icon-containerIcon wrapper .chat-widget__thoughts-iconChevron icon .chat-widget__thoughts-contentExpanded content area .chat-widget__thoughts-textThoughts text (monospace)
Class Description .chat-widget__inputInput container .chat-widget__formForm wrapper .chat-widget__textareaText input field .chat-widget__toolbarToolbar area (mic button, etc.) .chat-widget__submitSend button .chat-widget__send-iconSend button icon
Class Description .chat-widget__mic-buttonMicrophone button .chat-widget__mic-button--activeActive recording state .chat-widget__mic-iconMicrophone icon .chat-widget__mic-barVolume indicator bar .chat-widget__mic-bar-fillVolume level fill .chat-widget__voiceVoice playback container .chat-widget__voice-buttonPlay voice button .chat-widget__voice-button--activePlaying state .chat-widget__voice-iconVoice icon .chat-widget__voice-icon--spinLoading spinner state
Class Description .chat-widget__feedbackFeedback buttons container .chat-widget__feedback-buttonFeedback button base .chat-widget__feedback-button--positiveThumbs up button .chat-widget__feedback-button--negativeThumbs down button .chat-widget__feedback-button--commentComment button .chat-widget__feedback-button--selectedSelected state .chat-widget__feedback-button--has-contentHas comment state .chat-widget__feedback-iconFeedback icon .chat-widget__feedback-comment-sectionComment input section .chat-widget__feedback-textareaComment textarea .chat-widget__feedback-submitSubmit comment button .chat-widget__feedback-cancelCancel button
Class Description .chat-widget__loadingLoading indicator container .chat-widget__loading-bubbleLoading bubble .chat-widget__loading-dotsDots container .chat-widget__loading-dotIndividual dot (animated)
Class Description .chat-widget__collapsedCollapsed content wrapper .chat-widget__collapsed-contentExpandable content (CSS grid) .chat-widget__collapsed-content--expandedExpanded state .chat-widget__collapsed-previewPreview when collapsed .chat-widget__collapsed-gradientFade gradient overlay .chat-widget__collapsed-toggleExpand/collapse button
Class Description .chat-popup__anchorAnchor button container .chat-popup--startLeft-aligned variant .chat-popup__anchor-buttonFloating action button .chat-popup__anchor-iconButton icon .chat-popup__panelPopup panel container .chat-popup__panel--openOpen state .chat-popup__panel--closedClosed state .chat-popup__panel-innerInner panel wrapper .chat-popup__closeClose button container .chat-popup__close-buttonClose button .chat-popup__close-iconClose icon
< ChatWidget
styles = {{
primaryColor: '#6366f1' ,
backgroundColor: '#1f2937' ,
borderColor: '#374151' ,
assistantBubbleBackground: '#374151' ,
assistantBubbleTextColor: '#f9fafb' ,
inputBackground: '#374151' ,
inputTextColor: '#f9fafb' ,
inputPlaceholderColor: '#9ca3af' ,
thoughtsBorderColor: '#4b5563' ,
}}
/>
Or using CSS variables:
[ data-chat-widget ] {
--chat-primary : #6366f1 ;
--chat-background : #1f2937 ;
--chat-border : #374151 ;
--chat-assistant-bg : #374151 ;
--chat-assistant-text : #f9fafb ;
--chat-input-bg : #374151 ;
--chat-input-text : #f9fafb ;
--chat-input-placeholder : #9ca3af ;
--chat-thought-border : #4b5563 ;
}
[ data-chat-widget ] {
--chat-border : transparent ;
--chat-radius : 0.5 rem ;
--chat-assistant-bg : transparent ;
}
.chat-widget {
box-shadow : none ;
border : none ;
}
.chat-widget__bubble--user {
border-radius : 1 rem ;
}
[ data-chat-widget ] {
--chat-font-size : 1 rem ;
--chat-thought-font-size : 0.875 rem ;
}
.chat-widget__title {
font-size : 1 rem ;
}
.chat-widget__textarea {
font-size : 1 rem ;
}