Message is a conversational message wrapper to show messages in a friendly way. Branded versions offer product color accents for the first person.
Default message
Create a default Message by adding the class .hc-message to any element, typically a block-level element. It’s recommended that you also add a recipient class as well for the positioning and layout: .hc-message--sent or .hc-message--received. More on this below.
The overall structure of the message should include at most 3 child elements all as siblings. It doesn’t matter which order these elements are placed, just as long as they have the correct class names.
.hc-message-user: Contains either a menu button or a user avatar.
.hc-message-content: The message content. This should typically be a distinct message; multiple messages should be in multiple Message components.
.hc-message-meta: Wrapper for the message’s sent time (.hc-message-time) and read receipt (.hc-message-receipt), if relevant.
The message wrapper uses a grid-template to position everything, accounting for sender and which elements are present. The grid will automatically adjust based on these elements’ presence or lack thereof.
Sent and received styles
Adding the classes .hc-message--sent and .hc-message--received will toggle the message position and colors.
For messages received, we recommend adding an Avatar for the message sender. For messages sent by the active user, while you can repeat this users avatar as well, you can provide an action button here that might be more useful.
Branded sent messages
You can force the theme’s color tint on sent messages by adding .hc-message--brand to either the individual sent message itself or the message group to apply this to all sent messages inside the group.
If you’d like to enforce a particular brand’s colorway, instead add .hc-message--boost (or a different brand class) to these same elements.
Message groups
Wrap all messages inside of a block level element with class .hc-message-group to automatically handle gaps and positioning. The previous example uses this wrapper element.
Note that the rounded corners on message bubbles and the gaps between messages are automatically handled without any additional classes beyond the sent and received identifiers.