Styles
Properties related to chat styling.
style
| chatStyle
- Type:
CustomStyle
Styling for the chat's container element.
It can either be defined via the style
attribute
or a chatStyle
property that accepts an object. Both of these have the SAME outcome
and are to be chosen by developer preference or framework compatibility.
Example
- Sample code
- Full code
<deep-chat style="background-color: #f7f7f7; border-radius: 8px"></deep-chat>
<deep-chat chatStyle='{"backgroundColor": "#f7f7f7", "borderRadius": "8px"}'></deep-chat>
<!-- This example is for Vanilla JS and should be tailored to your framework (see Examples) -->
<deep-chat style="background-color: #f7f7f7; border-radius: 8px" demo="true"></deep-chat>
<deep-chat chatStyle='{"backgroundColor": "#f7f7f7", "borderRadius": "8px"}' demo="true"></deep-chat>
attachmentContainerStyle
- Type:
CustomStyle
Object containing CSS styling properties for the element containing files attachments ready to be sent with the message.
Example
- Sample code
- Full code
<deep-chat attachmentContainerStyle='{"backgroundColor": "#b2e1ff57"}'></deep-chat>
<!-- This example is for Vanilla JS and should be tailored to your framework (see Examples) -->
<deep-chat
attachmentContainerStyle='{"backgroundColor": "#b2e1ff57"}'
demo='{"displayFileAttachmentContainer": true}'
style="border-radius: 8px"
></deep-chat>
dropupStyles
- Type: {
button?: Button
,
menu?:
{
container?: CustomStyle
,
item?: StatefulStyles
,
iconContainer?: CustomStyle
,
text?: CustomStyle
}}
Configuration for the dropup button and its menu element styles.
Example
- Sample code
- Full code
<deep-chat
dropupStyles='{
"button": {
"styles": {
"container": {
"default": {"backgroundColor": "#eff8ff"},
"hover": {"backgroundColor": "#e4f3ff"},
"click": {"backgroundColor": "#d7edff"}
}
}
},
"menu": {
"container": {
"boxShadow": "#e2e2e2 0px 1px 3px 2px"
},
"item": {
"hover": {
"backgroundColor": "#e1f2ff"
},
"click": {
"backgroundColor": "#cfeaff"
}
},
"iconContainer": {
"width": "1.8em"
},
"text": {
"fontSize": "1.05em"
}
}
}'
></deep-chat>
<!-- This example is for Vanilla JS and should be tailored to your framework (see Examples) -->
<deep-chat
dropupStyles='{
"button": {
"styles": {
"container": {
"default": {"backgroundColor": "#eff8ff"},
"hover": {"backgroundColor": "#e4f3ff"},
"click": {"backgroundColor": "#d7edff"}
}
}
},
"menu": {
"container": {
"boxShadow": "#e2e2e2 0px 1px 3px 2px"
},
"item": {
"hover": {
"backgroundColor": "#e1f2ff"
},
"click": {
"backgroundColor": "#cfeaff"
}
},
"iconContainer": {
"width": "1.8em"
},
"text": {
"fontSize": "1.05em"
}
}
}'
demo="true"
style="border-radius: 8px"
audio='{"button": {"position": "dropup-menu"}}'
images='{"button": {"position": "dropup-menu"}}'
introMessage='{"text": "Open the dropup by clicking the + button on bottom left of the input."}'
></deep-chat>
inputAreaStyle
- Type:
CustomStyle
Styling for the chat view's bottom area dedicated for text input and file buttons.
Example
- Sample code
- Full code
<deep-chat inputAreaStyle='{"backgroundColor": "#ebf5ff"}'></deep-chat>
<!-- This example is for Vanilla JS and should be tailored to your framework (see Examples) -->
<deep-chat inputAreaStyle='{"backgroundColor": "#ebf5ff"}' style="border-radius: 8px" demo="true"></deep-chat>
textInput
- Type: {
styles?:
{text?: CustomStyle
,container?: CustomStyle
,focus?: CustomStyle
},
placeholder?:
{text?: string
,style?: CustomStyle
},
characterLimit?: number
,
disabled?: boolean
}
Custom details for the chat's text input.
styles
object defines the styling for the text
element and its box container
. The focus
property is used to set the container style when it is focused.
placeholder
object's text
property is the initial text that is displayed on the input before the user makes any actions and
style
can be used to customize it. Use setPlaceholderText
to change it dynamically.
characterLimit
is the maximum number of charactes that can be inserted into the text input.
disabled
is used to prevent the user from inserting text. This also comes with its own custom styling.
Generic example
- Sample code
- Full code
<deep-chat
textInput='{
"styles": {
"text": {"color": "black"},
"container": {"maxHeight": "50px", "backgroundColor": "#f5f9ff"},
"focus": {"border": "2px solid #a2a2ff"}
},
"placeholder": {"text": "Insert text here...", "style": {"color": "#4459a4"}},
"characterLimit": 10
}'
></deep-chat>
<!-- This example is for Vanilla JS and should be tailored to your framework (see Examples) -->
<deep-chat
textInput='{
"styles": {
"text": {"color": "black"},
"container": {"maxHeight": "50px", "backgroundColor": "#f5f9ff"},
"focus": {"border": "2px solid #a2a2ff"}
},
"placeholder": {"text": "Insert text here...", "style": {"color": "#4459a4"}},
"characterLimit": 10
}'
style="border-radius: 8px"
demo="true"
></deep-chat>
Disabled example
- Sample code
- Full code
<deep-chat
textInput='{
"disabled": true,
"placeholder": {
"text": "Text not allowed..."
}}'
></deep-chat>
<!-- This example is for Vanilla JS and should be tailored to your framework (see Examples) -->
<deep-chat
textInput='{
"disabled": true,
"placeholder": {
"text": "Text not allowed..."
}}'
style="border-radius: 8px"
demo="true"
></deep-chat>
auxiliaryStyle
- Type:
string
This value uses CSS syntax as an alternative way to define styling in Deep Chat.
It can be used to configure Webkit CSS
which cannot be added through component's style
properties. A great example of this is the ::-webkit-scrollbar
pseudo element which affects the style of the component's scrollbar.
It can also be used to add custom styling to html
messages and override Deep Chat CSS.
Example
- Sample code
- Full code
<deep-chat
auxiliaryStyle="
::-webkit-scrollbar {
width: 10px;
height: 10px;
}
::-webkit-scrollbar-thumb {
background-color: #54a7ff;
border-radius: 5px;
}"
></deep-chat>
<!-- This example is for Vanilla JS and should be tailored to your framework (see Examples) -->
<deep-chat
auxiliaryStyle="
::-webkit-scrollbar {
width: 10px;
height: 10px;
}
::-webkit-scrollbar-thumb {
background-color: #54a7ff;
border-radius: 5px;
}"
history='[
{"text": "Hey, how are you?", "role": "user"},
{"text": "I am doing great, how about you?", "role": "ai"},
{"text": "What is the meaning of life?", "role": "user"},
{
"text": "This ultimately depends on the person, but it could be the pursuit of happiness or fulfillment.",
"role": "ai"
},
{"text": "I just feel like sleeping all day...", "role": "user"},
{"text": "As long as it makes you happy!", "role": "ai"}
]'
style="border-radius: 8px"
demo="true"
></deep-chat>
Webkit CSS
is not standardised across all browsers, make sure to check the browser support
for the property you are using.
Types
Types shared by styles properties:
CustomStyle
- Type:
CSSStyleDeclaration
Object containing properties defined in the CSSStyleDeclaration specification
as optionals. A TypeScript example can be found in this link.
StatefulStyles
Object defining styling properties for different mouse states on the element.