You can use the Chat Message UI Pattern to display conversational posts in notifications or chat screens. It can be used to display content such as photos, text, images, delivery times, and statuses.
How to use the Chat Message UI Pattern
For the purposes of this example, our app already contains a form where the user can enter their queries, and once they send their message, it will appear as a conversational post by using the Chat Message widget.
In Service Studio, in the Toolbox, search for
The Chat Message widget is displayed.
To From the Toolbox, drag the Chat Message widget into the Main Content area of your application's screen.
By default, the Chat Message widget contains Image, Name, Content, and Actions placeholders.
Add the relevant content to the placeholders.
In this example, so that the name the user enters in the form is displayed, we convert the Name placeholder to an expression and enter the relevant logic. To do this, we right-click the Name placeholder, select Convert to Expression, and in the Expression Value pop-up, navigate to the Name attribute, and click Done.
So that the message the user enters in the form is displayed, we convert the Content placeholder to an expression and enter the relevant logic. To do this, we repeat the previous step, but this time, navigate to the Message attribute.
You can customize the Chat Message's look and feel by setting the (optional) properties on the Properties tab.
After following these steps and publishing the module, you can test the pattern in your app.
The result of this example looks something like the following:
|IsRight (Boolean): Optional||If True, the pattern is right aligned. If False, the pattern is left aligned. This is the default value.|
|IsInline (Boolean): Optional||If False, the chat message is displayed inside a balloon-style box. This is the default value. If True, the chat message does appear inside the balloon-style box.|
|Color (Color Identifier): Optional||Set the chat message background color. Red, orange, yellow, lime, green, blue, violet, and pink are just some of predefined colors available.
|ExtendedClass (Text): Optional||Add custom style classes to the Chat Message UI Pattern. You define your custom style classes in your application using CSS.