Give the assistant a personality: set title, subtitle, botName,
userName and image botAvatar / userAvatar (any URL or data-URI).
Leave the avatars unset to fall back to themed initials.
Brand the jqxChat assistant with custom avatars, name, title and subtitle.
A live JavaScript/jQuery example of jqxChat, the jQWidgets Chat component, with its complete source code below. It is one of 5 jqxChat demos for jQuery.
botAvatar property – Sets or gets the assistant avatar image.botName property – Sets or gets the display name of the assistant, shown in the message meta and used for the assistant avatar initial.colorScheme property – Sets or gets the colour scheme of the chat.height property – Sets or gets the chat's height.sendButtonIcon property – Sets or gets whether the send button is rendered as a circular icon (true) or as a text label using sendButtonLabel (false).sendRequest property – Sets or gets a callback that fully controls transport: function(payload, widget) .showTimestamps property – Sets or gets whether a timestamp is shown in each message's meta line.starterPrompts property – Sets or gets an array of suggested prompt strings displayed as clickable chips when the conversation is empty.subtitle property – Sets or gets the header subtitle text shown under the title.theme property – Sets the widget's theme.title property – Sets or gets the header title text (also used as the popup launcher tooltip).userAvatar property – Sets or gets the user avatar image.userName property – Sets or gets the display name of the user, shown in the message meta and used for the user avatar initial.welcomeMessage property – Sets or gets the welcome text (Markdown supported) shown in the empty state above the starter prompts.width property – Sets or gets the chat's width.To run it in your own page, load jqx.base.css, a theme and the library files below from npm (npm install jqwidgets-scripts) or the jsDelivr CDN, then add the markup and the script. jQuery is not required: jqxcore.js provides $.
The page loads jqx.base.css, a theme and these library files: jqxcore.js, jqxchat.js.
It also loads helper scripts of this demo site, which are not part of the library: demos.js (getWidth() and other layout helpers), mockassistant.js.
$(document).ready(function () {
// small inline SVG data-URI avatars so the demo has no external assets.
var botAvatar = 'data:image/svg+xml;utf8,' + encodeURIComponent(
'<svg xmlns="http://www.w3.org/2000/svg" width="64" height="64"><rect width="64" height="64" fill="#2b6cb0"/>' +
'<circle cx="32" cy="26" r="12" fill="#fff"/><rect x="14" y="42" width="36" height="18" rx="9" fill="#fff"/></svg>');
var userAvatar = 'data:image/svg+xml;utf8,' + encodeURIComponent(
'<svg xmlns="http://www.w3.org/2000/svg" width="64" height="64"><rect width="64" height="64" fill="#48bb78"/>' +
'<text x="32" y="42" font-size="30" fill="#fff" text-anchor="middle" font-family="Arial">U</text></svg>');
$('#chat').jqxChat({
colorScheme: 'auto',
theme: 'light',
width: 440,
height: 600,
title: 'Nova',
subtitle: 'Your product guide',
botName: 'Nova',
userName: 'Me',
botAvatar: botAvatar,
userAvatar: userAvatar,
showTimestamps: true,
sendButtonIcon: true,
welcomeMessage: 'Hi, I\'m **Nova** - your product guide. What would you like to know?',
starterPrompts: ['What is jQWidgets?', 'Show me a code example'],
sendRequest: jqxChatMock
});
});
<p class="hint">
Give the assistant a personality: set <code>title</code>, <code>subtitle</code>, <code>botName</code>,
<code>userName</code> and image <code>botAvatar</code> / <code>userAvatar</code> (any URL or data-URI).
Leave the avatars unset to fall back to themed initials.
</p>
<div id="chat"></div>