Skip to content

Widget Tag & Options

Complete reference for all available attributes and configuration options for the Infinity Widget.

HTML Attributes

Connection & Backend

AttributeTypeDefaultDescription
backendString'websocket'Backend protocol type
protocolString'ws'WebSocket protocol (ws/wss)
websocket-urlStringRequiredWebSocket server URL

Appearance & Theme

AttributeTypeDefaultDescription
themeString'light'Widget theme (light, dark, auto)
titleString'Infinity Bot'Widget title/header text
no-styleBooleanfalseDisable default styling

Messages & Content

AttributeTypeDefaultDescription
welcome-messageString-Initial welcome message
user-avatarString-URL for user avatar image
bot-avatarString-URL for bot avatar image
max-messagesNumber100Maximum messages to display
persistent-historyBooleanfalseSave chat history locally
markdownBooleantrueEnable markdown rendering
timestampsBooleantrueShow message timestamps

Behavior

AttributeTypeDefaultDescription
auto-scrollBooleantrueAuto-scroll to new messages
typing-indicatorBooleantrueShow typing indicator
auto-focusBooleanfalseAuto-focus input on load
disabledBooleanfalseDisable widget interactions
fullscreenBooleanfalseStart in fullscreen mode
debugBooleanfalseEnable debug logging

Floating Mode

AttributeTypeDefaultDescription
display-modeString'embedded'Display mode (embedded, floating)
bubble-positionString'bottom-right'Floating bubble position
auto-minimizeBooleanfalseAuto-minimize after timeout
minimize-timeoutNumber30000Auto-minimize timeout (ms)
bubble-sizeString'medium'Bubble size (small, medium, large)

Internationalization

AttributeTypeDefaultDescription
langString'en'Language code (ISO 639-1)
languageString'en'Alternative language attribute

CSS Custom Properties

Customize the widget appearance using CSS custom properties:

css
infinity-widget {
  /* Colors */
  --primary-color: #007bff;
  --secondary-color: #6c757d;
  --background-color: #ffffff;
  --text-color: #333333;
  --border-color: #e9ecef;
  --shadow-color: rgba(0, 0, 0, 0.15);
  
  /* Spacing */
  --padding: 16px;
  --margin: 8px;
  --border-radius: 8px;
  
  /* Typography */
  --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-size: 14px;
  --line-height: 1.5;
  
  /* Dimensions */
  --widget-width: 400px;
  --widget-height: 600px;
  --bubble-size: 60px;
}

Examples

Basic Configuration

html
<infinity-widget 
  websocket-url="wss://api.example.com/ws"
  theme="light"
  welcome-message="Hello! How can I help you today?">
</infinity-widget>

Advanced Configuration

html
<infinity-widget 
  websocket-url="wss://api.example.com/ws"
  theme="dark"
  display-mode="floating"
  bubble-position="bottom-left"
  auto-minimize="true"
  minimize-timeout="60000"
  user-avatar="/images/user.png"
  bot-avatar="/images/bot.png"
  max-messages="50"
  persistent-history="true"
  lang="es">
</infinity-widget>

Custom Styling

html
<style>
  infinity-widget {
    --primary-color: #28a745;
    --background-color: #f8f9fa;
    --border-radius: 12px;
    --widget-width: 350px;
    --widget-height: 500px;
  }
</style>

<infinity-widget 
  websocket-url="wss://api.example.com/ws"
  theme="light">
</infinity-widget>

Validation

The widget validates all attributes and will log warnings for invalid values:

  • URLs must be valid WebSocket URLs (ws:// or wss://)
  • Numbers must be positive integers
  • Enums must match allowed values
  • Boolean attributes accept "true", "false", or their presence/absence

Built with ❤️ by CI&T