Skip to main content

Overview

The AI Chat SDK provides customization options to ensure the chat experience seamlessly matches your application’s brand identity. You can customize branding, colors, fonts, and layout.

Brand configuration

Configure your brand identity using the brand option available in chatConfig, badgeConfig, and inlineConfig.
chatConfig: {
  brand: {
    name: 'Your Brand',
    logoUrl: 'https://your-app.com/logo.png',
  },
}

Brand options

OptionTypeDescription
namestringYour brand name displayed in the UI
logoUrlstringURL to your logo image
logoReact.ReactNodeReact component for custom logo rendering
Logo requirements:
  • Format: PNG, SVG, or JPG
  • Size: 200x200px minimum (square aspect ratio recommended)
  • Background: Transparent PNG recommended
  • File size: <100KB for best performance

Using a custom logo component

For React applications, you can pass a custom logo component:
import { MyLogo } from './components/MyLogo';

chatConfig: {
  brand: {
    name: 'Your Brand',
    logo: <MyLogo width={32} height={32} />,
  },
}

Color customization

Configure colors using the styling option available in chatConfig, badgeConfig, and inlineConfig.
chatConfig: {
  styling: {
    primaryColor: '#5C59FE',
    primaryColorDarkMode: '#8B87FF',
    colorMode: 'system',
  },
}

Styling options

OptionTypeDefaultDescription
primaryColorstring#5C59FEPrimary brand color for light mode
primaryColorDarkModestring(uses primaryColor)Primary brand color for dark mode
colorMode'light' | 'dark' | 'system''system'Color mode preference

Color mode

Control how the SDK handles light and dark themes:
  • 'system' (default): Automatically matches the user’s system preference
  • 'light': Always use light mode colors
  • 'dark': Always use dark mode colors
chatConfig: {
  styling: {
    colorMode: 'system',  // Respects user's OS preference
  },
}

Brand color examples

styling: {
  primaryColor: '#2563eb',
  primaryColorDarkMode: '#60a5fa',
  colorMode: 'system',
}
Ensure your custom font is loaded on the page before initializing the SDK.

Assistant configuration

Configure the AI assistant’s identity using the assistant option.
chatConfig: {
  assistant: {
    name: 'Shopping Assistant',
    description: 'Your AI shopping helper',
    settingsUrl: 'https://example.com/settings',
  },
}

Assistant options

OptionTypeDescription
namestringName displayed in the chat header
descriptionstringDescription shown below the name
settingsUrlstringLink to settings page (optional)

Layout customization

Position and size

Control where the chat panel appears on the page:
chatConfig: {
  layout: {
    position: {
      right: '0px',
      bottom: '0px',
    },
    size: {
      width: '400px',
      height: '100vh',
    },
  },
}

Common layout patterns

Visual styling

Customize the panel’s visual appearance:
chatConfig: {
  layout: {
    position: { right: '20px', bottom: '20px' },
    size: { width: '400px', height: '600px' },
  },
}

Layout options

OptionTypeDefaultDescription
position.topstring'unset'Distance from top
position.rightstring'0px'Distance from right
position.bottomstring'0px'Distance from bottom
position.leftstring'unset'Distance from left
size.widthstring'auto'Panel width
size.heightstring'auto'Panel height
size.minWidthstring'auto'Minimum width
size.maxWidthstring'none'Maximum width
size.minHeightstring'auto'Minimum height
size.maxHeightstring'none'Maximum height

Content customization

Customize text content displayed throughout the chat interface. Customize the chat header with your logo and brand name:
chatConfig: {
  content: {
    header: {
      logo: <YourLogoComponent />,  // React node for custom logo
      logoUrl: 'https://example.com/logo.png',  // Or URL for logo image
      name: 'Your Brand AI',  // Brand name displayed in header
    },
  },
}
OptionTypeDescription
logoReact.ReactNodeReact component for custom logo rendering (height 36px, preserves aspect ratio). Falls back to brand.logo if neither logo nor logoUrl provided.
logoUrlstringURL to your logo image (height 36px, preserves aspect ratio). Falls back to brand.logoUrl if neither logo nor logoUrl provided.
namestringBrand/product name displayed in the header. Falls back to brand.name if not provided.
You can use either logo (React component) or logoUrl (image URL). If neither is provided, the SDK will fall back to the corresponding brand config values.

Default prompts

Provide suggested prompts for users:
chatConfig: {
  content: {
    defaultPrompts: ['Show me deals', 'Compare prices', 'Find discounts'],
  },
}

Input placeholder

Customize the input field placeholder:
chatConfig: {
  content: {
    input: {
      placeholder: 'Ask about products...',
    },
  },
}

Intro screen

Customize the intro message shown when chat opens:
chatConfig: {
  content: {
    intro: {
      title: 'Welcome!',
      message: 'How can I help you find what you need?',
    },
  },
}

Loading messages

Customize loading messages that cycle while waiting for responses:
chatConfig: {
  content: {
    loading: {
      messages: ['Thinking...', 'Finding the best options...', 'Almost there...'],
    },
  },
}

Error messages

Customize error message text:
chatConfig: {
  content: {
    error: {
      message: 'Something went wrong. Please try again.',
    },
  },
}

Disclaimer text

Customize the disclaimer text:
chatConfig: {
  content: {
    disclaimerText: 'AI responses may not always be accurate. Please verify information.',
  },
}

Badge customization

Customize the floating badge entry point:
badgeConfig: {
  // Control badge behavior
  allowExpand: true,
  autoCollapse: true,

  // Branding (same options as chatConfig)
  brand: {
    name: 'Your Brand',
    logoUrl: 'https://your-app.com/logo.png',
  },

  // Styling (same options as chatConfig)
  styling: {
    primaryColor: '#5C59FE',
    colorMode: 'system',
  },

  // Badge-specific content
  content: {
    badge: {
      text: 'Ask AI',
    },
    onboarding: {
      title: 'Need help?',
      description: 'Click here to chat with our AI assistant',
    },
  },

  // Position the badge
  layout: {
    position: {
      right: '20px',
      bottom: '20px',
    },
  },
}

Inline input customization

Customize the inline input entry point:
inlineConfig: {
  // Branding (same options as chatConfig)
  brand: {
    name: 'Your Brand',
  },

  // Styling (same options as chatConfig)
  styling: {
    primaryColor: '#5C59FE',
  },

  // Inline-specific content
  content: {
    input: {
      placeholder: 'Ask me anything...',
    },
  },

  // Specify where to render
  layout: {
    containerSelector: '#chat-container',
    insertPosition: 'append',  // or 'prepend'
  },
}

Complete customization example

Here’s a fully customized configuration:
import { initializeAiChatSdk } from '@sleek/ai-chat-sdk';

initializeAiChatSdk('your-api-key', {
  enableDebug: process.env.NODE_ENV === 'development',

  // Chat panel customization
  chatConfig: {
    usePageContext: true,
    messageLimitPerThread: 50,

    // Assistant identity
    assistant: {
      name: 'Shopping Assistant',
      description: 'Find the best deals and products',
    },

    // Branding
    brand: {
      name: 'Your Brand',
      logoUrl: 'https://your-app.com/logo.png',
    },

    // Colors and fonts
    styling: {
      primaryColor: '#6366f1',
      primaryColorDarkMode: '#818cf8',
      colorMode: 'system',
    },

    // Content
    content: {
      header: {
        logoUrl: 'https://your-app.com/header-logo.png',
        name: 'Shopping Assistant',
      },
      defaultPrompts: ['Show me deals', 'Compare prices', 'Find discounts'],
      disclaimerText: 'AI responses may not always be accurate',
      input: {
        placeholder: 'Ask about products...',
      },
      intro: {
        title: 'Welcome!',
        message: 'How can I help you find what you need?',
      },
      loading: {
        messages: ['Thinking...', 'Finding options...'],
      },
    },

    // Layout
    layout: {
      position: {
        right: '0px',
        bottom: '0px',
      },
      size: {
        width: '420px',
        height: '100vh',
      },
    },
  },

  // Badge customization
  badgeConfig: {
    allowExpand: true,
    autoCollapse: true,
    brand: {
      logoUrl: 'https://your-app.com/logo.png',
    },
    styling: {
      primaryColor: '#6366f1',
    },
    content: {
      badge: {
        text: 'Ask AI',
      },
    },
    layout: {
      position: {
        right: '20px',
        bottom: '20px',
      },
    },
  },

  // Data providers
  dataProviders: {
    offerRedirectUrlProvider: async (url) => null,
    merchantCashbackProvider: async (urls) => ({}),
  },
});

Best practices

Use the same colors, logos, and fonts as your main application UI to create a cohesive experience.
If using colorMode: 'system', test your customization in both light and dark modes:
styling: {
  primaryColor: '#5C59FE',           // Good contrast on light backgrounds
  primaryColorDarkMode: '#8B87FF',   // Good contrast on dark backgrounds
  colorMode: 'system',
}
  • Use SVG for scalable logos
  • Optimize PNG files to <100KB
  • Serve logos from a CDN for fast loading
  • Use transparent backgrounds
Ensure sufficient contrast for readability:
  • Text on backgrounds: 4.5:1 contrast ratio minimum
  • Interactive elements: 3:1 contrast ratio minimum
Use tools like WebAIM Contrast Checker to verify.
Test the chat panel on different screen sizes to ensure it doesn’t obscure critical page content.
For mobile, consider adjusting the layout:
const isMobile = window.innerWidth < 768;

chatConfig: {
  layout: {
    size: {
      width: isMobile ? '100vw' : '400px',
      height: isMobile ? '100vh' : '600px',
    },
  },
}

Troubleshooting

Causes:
  • Invalid logo URL
  • CORS restrictions on logo image
  • Logo URL not accessible
Solutions:
  • Verify logo URL is accessible in browser
  • Host logo on a CDN with CORS enabled
  • Check browser DevTools for network errors
Causes:
  • Browser color profile differences
  • System color mode affecting display
  • Transparency effects
Solutions:
  • Test on multiple browsers
  • Use specific hex color values
  • Check colorMode setting
Causes:
  • Font not loaded before SDK initialization
  • Incorrect font family syntax
Solutions:
  • Ensure font is loaded (use document.fonts.ready)
  • Include fallback fonts in the font family string
  • Verify font name matches the loaded font
Causes:
  • Incorrect positioning
  • Size too large for viewport
Solutions:
  • Adjust position and size values
  • Use responsive sizing based on viewport
  • Test on different screen sizes