The ability to update the style of the lex-web-ui to conform to an existing site's style is important. This guide will walk you through adjusting the UI to meet your needs.
This guide does not cover the case if you are building lex-web-ui for use as a component in other Vue apps or modifing Vue source components for your own implementation.
As noted on the bottom of the diagram, if using a parent page to host the lex-web-ui as an iframe, the iframe size and width and position an be controlled using css applied to the parent page.
.lex-web-ui-iframe {
min-width: 25vw !important;
max-height: 315px !important;
margin-right: 10vw !important;
margin-bottom: 10px !important;
}
Note that these values can be specified using vw and vh to reflect percentages of the view window's width and height.
Use the following process to set style after the lex-web-ui has been deployed.
Note: Version 0.14.11 pre-installs with the file custom-chatbot-style.css and pre-configures its use in index.html. Download the file from S3. Follow steps 2 and 3. The default file has all styles commented out. Enable style changes you desire and upload the file back to S3. Make sure after uploading back to S3 you have set the acl on this object to public-read.
- Create a new css file named 'custom-chatbot-style.css'.
- Configure/update the style as needed
- Upload the 'custom-chatbot-style.css' file to the S3 bucket hosting the lex-web-ui. Make sure this file has an acl of public-read.
- Download and modify the index.html file from the S3 bucket. Insert the html below within the <head> element at the end of this element.
- Upload the index.html back to the S3 bucket and make sure the file has an acl of public-read.
Changes for index.html for versions prior to 0.14.11.
<link rel="stylesheet" href="./custom-chatbot-styles.css">
The new css file will then hold style changes for the elements in the UI.
There are two distinct mechanisms for changing the background color.
- Update lex-web-ui-loader-config.json. Change the property ui.toolbarColor. You must select a value from. https://vuetifyjs.com/en/styles/colors#
- OR use the following in css
.toolbar.theme--dark {
background-color: #2b2b2b !important;
}
.toolbar__title {
font-family:"Sans-serif" !important;
font-size: 16px !important;
color: #ffffff !important;
}
Modify lex-web-ui-loader-config.json
ui.toolbarLogo: "url"
Modify lex-web-ui-loader-config.json
ui.avatarImageUrl: "url"
.message-list-container {
background-color: #fefefe !important
}
Set background of the bot's response messages
.message-bot .message-bubble {
background-color: #eeedeb !important;
}
.message-human .message-bubble {
background-color: #afcffa !important;
}
.message-bubble p {
margin-bottom: 8px;
}
.message-bubble p:last-child {
margin-bottom: 0px;
}
.message-bubble {
border-radius: 10px !important;
padding: 2px 18px !important;
}
.message-bubble .message-text {
padding-left: 0;
padding-right: 0;
line-height: 1.6;
font-size: 1rem;
}
.message-text {
color: #000000
}
.headline {
font-size: 1.2rem !important;
line-height: 1.4 !important;
}
.card__title {
padding: 10px 16px !important;
}
.card__text {
padding: 8px 16px 16px !important;
line-height: 1.4;
}
.input-group--text-field input,
.input-group--text-field textarea,
.input-group--text-field label {
font-size: 14px !important;
}
Other CSS can be applied to the classes above in addition to what is listed. Be creative and create a compelling style for your site.