Skip to main content

Styles

Properties related to message styling.

messageStyles

Object defining the styling for various message types.
default is applied to all message types.
image is applied to messages that contain an image.
audio is applied to messages that contain an audio player.
file is applied to messages that contain a file attachment.
html is applied to messages that contain custom elements - more info.
intro is applied to the introMessage.
loading is applied to the loading bubble.
error is applied to error messages.

Types

Shared property types for the messageStyles object:

MessageRoleStyles

Object defining the styling for various message roles.
shared is applied to all message roles.
user is applied to messages from the user.
ai is applied to messages returned from the target service.
custom roles (e.g. "bob") use ai styling, but they can have additional styling.

<deep-chat
messageStyles='{
"default": {
"shared": {"bubble": {"color": "white"}},
"ai": {"bubble": {"backgroundColor": "#3cbe3c"}},
"user": {"bubble": {"backgroundColor": "#6767ff"}},
"bob": {"bubble": {"backgroundColor": "#ffa500"}}
}
}'
></deep-chat>

MessageElementsStyles

Object defining the styling for various elements that encompass a message.
outerContainer contains all elements related to the message.
innerContainer is an element inside the outerContainer that is mostly used to set message side padding.
bubble is the element that displays the actual message contents.
media is applied to image, audio and file type messages which contain an extra child element inside the bubble to display the file contents.

<deep-chat
messageStyles='{
"default": {
"shared": {
"outerContainer": {"backgroundColor": "orange"},
"innerContainer": {"backgroundColor": "yellow"},
"bubble": {"color": "black"}
},
"ai": {"bubble": {"backgroundColor": "lightgreen"}},
"user": {"bubble": {"backgroundColor": "lightblue"}}
}
}'
></deep-chat>

More Examples

Files

<deep-chat
messageStyles='{
"image": {
"shared": {
"media": {"borderRadius": "0px"}
}
},
"audio": {
"shared": {
"media": {"borderRadius": "30px", "border": "1px solid #8c8c8c", "backgroundColor": "red"}
}
},
"file": {
"shared": {
"bubble": {"backgroundColor": "grey"}
}
}
}'
></deep-chat>
info

The "audio" media player is controlled by the browser and and its styling may not be overwritable by the media property.

tip

In the Safari browser, the "audio" media player can be expanded by setting the width property in media to 200px or higher.

Intro message

<deep-chat
messageStyles='{
"intro": {"bubble": {"backgroundColor": "#475cc7", "color": "white", "fontSize": "16px"}}
}'
></deep-chat>

Loading bubble

<deep-chat
messageStyles='{
"loading": {
"bubble": {"backgroundColor": "#3793ff", "fontSize": "20px", "color": "white"}
}
}'
></deep-chat>

Error messages

<deep-chat
messageStyles='{
"error": {
"bubble": {"backgroundColor": "#f98e00", "color": "white", "fontSize": "15px"}
}
}'
></deep-chat>