Ensemble Docs

Styling Reference

Complete reference for customizing colors, fonts, and layout

Styling Reference

The chat widget can be customized using style props, CSS variables, or class names.

Style Props

Pass a styles object to configure the widget appearance programmatically.

<ChatWidget
  styles={{
    primaryColor: '#3b82f6',
    backgroundColor: '#ffffff',
    // ... other options
  }}
/>

Available Style Props

PropertyTypeDefaultDescription
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

Example: Full Configuration

<ChatWidget
  styles={{
    // 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',
  }}
/>

CSS Variables

Override styles globally using CSS custom properties on [data-chat-widget].

Core Variables

VariableDefaultDescription
--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

Typography Variables

VariableDefaultDescription
--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

Message Variables

VariableDefaultDescription
--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

Input Variables

VariableDefaultDescription
--chat-input-bg#ffffffInput area background
--chat-input-text#111827Input text color
--chat-input-placeholder#6b7280Placeholder color

Example: CSS Variable Override

[data-chat-widget] {
  --chat-primary: #8b5cf6;
  --chat-primary-hover: #7c3aed;
  --chat-background: #fafafa;
  --chat-border: #e5e7eb;
  --chat-font-family: 'Poppins', sans-serif;
  --chat-radius: 1rem;

  /* Messages */
  --chat-assistant-bg: #f3f4f6;
  --chat-assistant-text: #1f2937;

  /* Input */
  --chat-input-bg: #ffffff;
  --chat-input-text: #1f2937;
}

CSS Class Names

BEM-style class names for targeted CSS customization.

Container Classes

ClassDescription
.chat-widgetRoot container
.chat-widget__headerHeader bar
.chat-widget__titleHeader title text
.chat-widget__messagesScrollable message area

Message Classes

ClassDescription
.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

Thoughts Section Classes

ClassDescription
.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)

Input Classes

ClassDescription
.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

Voice Classes

ClassDescription
.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

Feedback Classes

ClassDescription
.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

Loading Classes

ClassDescription
.chat-widget__loadingLoading indicator container
.chat-widget__loading-bubbleLoading bubble
.chat-widget__loading-dotsDots container
.chat-widget__loading-dotIndividual dot (animated)

Collapsed Content Classes

ClassDescription
.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
ClassDescription
.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

Theme Examples

Dark Mode

<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;
}

Minimal / Borderless

[data-chat-widget] {
  --chat-border: transparent;
  --chat-radius: 0.5rem;
  --chat-assistant-bg: transparent;
}

.chat-widget {
  box-shadow: none;
  border: none;
}

.chat-widget__bubble--user {
  border-radius: 1rem;
}

Custom Font Sizing

[data-chat-widget] {
  --chat-font-size: 1rem;
  --chat-thought-font-size: 0.875rem;
}

.chat-widget__title {
  font-size: 1rem;
}

.chat-widget__textarea {
  font-size: 1rem;
}

On this page