widget/Widget Styling

Widget Styling

Both the chat and search widgets support extensive customization through themes, CSS custom properties, and custom CSS injection.

Theme Basics

Chat Widget Theme

window.intufindConfig = {
  publishableKey: 'if_pk_xxx',
  theme: {
    primaryColor: '#6101fe',
    widgetBackground: '#ffffff',
    fontFamily: '"Inter", sans-serif',
  },
};

Or update dynamically:

window.IntufindChatbot.setTheme({
  primaryColor: '#6101fe',
});

Search Widget Theme

window.intufindSearchConfig = {
  publishableKey: 'if_pk_xxx',
  theme: {
    primaryColor: '#6101fe',
    colorScheme: 'dark',
  },
};

Or update dynamically:

window.IntufindSearch.setTheme({
  primaryColor: '#6101fe',
});

Chat Widget Theme Options

Colors

PropertyDefaultDescription
primaryColor#6101fePrimary brand color
primaryHoverPrimary color on hover
primaryActivePrimary color when active
widgetBackground#ffffffMain widget background
backgroundSecondarySecondary background color
userBubbleBackground#6101feUser message bubble color
assistantBubbleBackground#f3f4f6Assistant message bubble color
textSecondarySecondary text color
textMutedMuted text color
borderColorDefault border color
focusBorderColorFocus state border color

Status Colors

PropertyDefaultDescription
successColor#10b981Success state color
warningColor#f59e0bWarning state color
errorColor#ef4444Error state color
infoColor#3b82f6Info state color

Spacing

PropertyDefaultDescription
spacing1remBase spacing unit
spacingSmall0.5remSmall spacing
spacingLarge1.5remLarge spacing
spacingXl2remExtra large spacing
borderRadius0.5remDefault border radius
borderRadiusSmall0.25remSmall border radius
borderRadiusLarge1remLarge border radius

Typography

PropertyDefaultDescription
fontFamilysystem fontFont family
fontSize0.875remBase font size
fontSizeSmall0.75remSmall font size
fontSizeLarge1remLarge font size
lineHeight1.5Base line height
fontWeight400Normal font weight
fontWeightBold600Bold font weight

Widget Dimensions

PropertyDefaultDescription
widgetWidth400pxDefault widget width
widgetMinWidth320pxMinimum width
widgetMaxWidth100vwMaximum width
widgetHeight600pxDefault widget height
widgetMinHeight400pxMinimum height
widgetMaxHeight100vhMaximum height

Shadows

PropertyDefaultDescription
shadowLightLight shadow
shadowMediumMedium shadow
shadowHeavyHeavy shadow
cardShadowCard shadow
focusShadowFocus ring shadow

Animations

PropertyDefaultDescription
transitionFast150msFast transition duration
transitionNormal200msNormal transition duration
transitionSlow300msSlow transition duration

Search Widget Theme Options

Color Scheme

window.IntufindSearch.setTheme({
  colorScheme: 'auto', // 'light', 'dark', or 'auto'
});

Component Themes

window.IntufindSearch.setTheme({
  // Overlay backdrop
  overlay: {
    background: 'rgba(0, 0, 0, 0.7)',
    blur: '12px',
  },
  
  // Modal container
  modal: {
    background: '#0a0a0a',
    border: 'rgba(255, 255, 255, 0.1)',
    borderRadius: '20px',
    shadow: '0 20px 60px rgba(0,0,0,0.3)',
    maxWidth: '800px',
  },
  
  // Search input
  input: {
    background: '#1a1a1a',
    text: '#ffffff',
    placeholder: 'rgba(255, 255, 255, 0.4)',
    border: 'rgba(255, 255, 255, 0.1)',
  },
  
  // Results list
  results: {
    background: 'transparent',
    hoverBackground: 'rgba(255, 255, 255, 0.08)',
    selectedBackground: 'rgba(255, 255, 255, 0.12)',
    text: '#ffffff',
    secondaryText: 'rgba(255, 255, 255, 0.5)',
  },
  
  // Search term highlighting
  highlight: {
    color: '#ffffff',
    background: 'rgba(97, 1, 254, 0.3)',
  },
  
  // Facet filter chips
  facets: {
    chipBackground: 'rgba(255, 255, 255, 0.08)',
    chipActiveBackground: '#6101fe',
    chipText: 'rgba(255, 255, 255, 0.6)',
    chipActiveText: '#ffffff',
  },
});

Custom CSS

For advanced customization, inject custom CSS:

Chat Widget

window.IntufindChatbot.setCustomCSS(`
  /* Custom header gradient */
  .itf-chat-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  }
  
  /* Rounded message bubbles */
  .itf-chat-bubble {
    border-radius: 20px;
  }
  
  /* Custom send button */
  .itf-chat-send-button {
    background: #6101fe;
    border-radius: 50%;
  }
`);

Search Widget

window.IntufindSearch.setCustomCSS(`
  /* Larger modal */
  .itf-search-modal {
    max-width: 900px;
  }
  
  /* Custom input styling */
  .itf-search-input {
    font-size: 18px;
    padding: 20px;
  }
  
  /* Custom result cards */
  .itf-search-result {
    border-radius: 12px;
    padding: 16px;
  }
`);

CSS Custom Properties

Both widgets use CSS custom properties (CSS variables) that you can override:

Chat Widget Variables

:root {
  /* Colors */
  --itf-chat-primary: #6101fe;
  --itf-chat-primary-hover: #5001d4;
  --itf-chat-background: #ffffff;
  --itf-chat-user-bubble: #6101fe;
  --itf-chat-assistant-bubble: #f3f4f6;
  --itf-chat-text: #1f2937;
  --itf-chat-text-secondary: #6b7280;
  --itf-chat-border: #e5e7eb;
  
  /* Spacing */
  --itf-chat-spacing: 1rem;
  --itf-chat-border-radius: 0.5rem;
  
  /* Typography */
  --itf-chat-font-family: system-ui, -apple-system, sans-serif;
  --itf-chat-font-size: 0.875rem;
}

Search Widget Variables

:root {
  /* Colors */
  --itf-search-primary: #6101fe;
  --itf-search-modal-bg: #0a0a0a;
  --itf-search-input-bg: #1a1a1a;
  --itf-search-input-text: #ffffff;
  --itf-search-result-text: #ffffff;
  --itf-search-result-hover: rgba(255, 255, 255, 0.08);
  --itf-search-highlight-bg: rgba(97, 1, 254, 0.3);
  
  /* Dimensions */
  --itf-search-modal-max-width: 800px;
  --itf-search-border-radius: 20px;
}

Theme Presets

Chat Widget Presets

// Dark theme
window.intufindConfig = {
  publishableKey: 'if_pk_xxx',
  themePreset: 'dark',
};

// Available presets: 'default', 'dark', 'minimal'

Search Widget Color Schemes

// Auto (follows system preference)
window.IntufindSearch.setTheme({ colorScheme: 'auto' });

// Always dark
window.IntufindSearch.setTheme({ colorScheme: 'dark' });

// Always light
window.IntufindSearch.setTheme({ colorScheme: 'light' });

Dark Mode

Chat Widget Dark Mode

Provide a separate dark theme:

window.intufindConfig = {
  publishableKey: 'if_pk_xxx',
  theme: {
    primaryColor: '#6101fe',
    widgetBackground: '#ffffff',
  },
  darkTheme: {
    widgetBackground: '#1a1a1a',
    assistantBubbleBackground: '#2d2d2d',
  },
};

Search Widget Dark Mode

The search widget automatically detects system preference when using colorScheme: 'auto':

window.intufindSearchConfig = {
  publishableKey: 'if_pk_xxx',
  theme: {
    colorScheme: 'auto',
    primaryColor: '#6101fe',
    darkPrimaryColor: '#8b5cf6', // Used in dark mode
  },
};

Examples

Minimal Light Theme

window.IntufindChatbot.setTheme({
  primaryColor: '#000000',
  widgetBackground: '#ffffff',
  userBubbleBackground: '#000000',
  assistantBubbleBackground: '#f5f5f5',
  borderRadius: '4px',
  fontFamily: '"Helvetica Neue", Arial, sans-serif',
});

Minimal light theme

Bold Brand Theme

window.IntufindChatbot.setTheme({
  primaryColor: '#ff6b00',
  widgetBackground: '#1a1a1a',
  userBubbleBackground: '#ff6b00',
  assistantBubbleBackground: '#2d2d2d',
  borderRadius: '16px',
  fontFamily: '"Poppins", sans-serif',
});

Bold brand theme

Glassmorphism Search

window.IntufindSearch.setTheme({
  colorScheme: 'dark',
  overlay: {
    background: 'rgba(0, 0, 0, 0.5)',
    blur: '20px',
  },
  modal: {
    background: 'rgba(255, 255, 255, 0.1)',
    border: 'rgba(255, 255, 255, 0.2)',
    borderRadius: '24px',
  },
  input: {
    background: 'rgba(255, 255, 255, 0.05)',
  },
});

Glassmorphism theme

Best Practices

Color Contrast

Ensure sufficient contrast for accessibility:

Consistent Branding

Match your website's design system:

  • Use your brand's primary color
  • Match font families
  • Use consistent border radius values
  • Align spacing with your grid system

Mobile Considerations

Test on mobile devices:

  • Touch targets should be at least 44x44px
  • Text should be readable without zooming
  • Ensure the widget doesn't overlap critical content

Performance

Keep custom CSS minimal:

  • Avoid expensive selectors
  • Don't override too many properties
  • Use CSS custom properties for dynamic values

Troubleshooting

Styles not applying

  1. Check CSS selector specificity
  2. Ensure setCustomCSS is called after widget loads
  3. Verify there are no typos in property names

Theme not updating

  1. Call setTheme() or configure() after changes
  2. Some properties require a page refresh
  3. Check console for validation errors

CSS conflicts

  1. Widget CSS uses .itf- prefix to avoid conflicts
  2. Check for overly broad selectors in your theme
  3. Use !important sparingly in custom CSS

Next Steps