TimeBreaks in Vue Chat UI component
18 Dec 20244 minutes to read
Show or hide time breaks
You can use the showTimeBreak property to display date-wise separations between all the messages which enhances the readability and message organizing. The default value is false, indicating time breaks are disabled unless it is enabled.
<template>
<div id='container' style="height: 380px; width: 450px; margin: 0 auto;">
<ejs-chatui :user="currentUser" :showTimeBreak="true">
<e-messages>
<e-message :author="currentUser" text="Hi Michale, are we on track for the deadline?" :timeStamp="new Date('December 25, 2024 7:30')"></e-message>
<e-message :author="michaleUser" text="Yes, the design phase is complete." :timeStamp="new Date('December 25, 2024 8:00')"></e-message>
<e-message :author="currentUser" text="I’ll review it and send feedback by today." :timeStamp="new Date('December 25, 2024 11:00')"></e-message>
</e-messages>
</ejs-chatui>
</div>
</template>
<script setup>
import { ChatUIComponent as EjsChatui, MessagesDirective as EMessages, MessageDirective as EMessage } from "@syncfusion/ej2-vue-interactive-chat";
const currentUser = {
id: "user1",
user: "Albert"
};
const michaleUser = {
id: "user2",
user: "Michale Suyama"
};
</script>
<style>
@import "../node_modules/@syncfusion/ej2-base/styles/material.css";
@import "../node_modules/@syncfusion/ej2-inputs/styles/material.css";
@import "../node_modules/@syncfusion/ej2-navigations/styles/material.css";
@import "../node_modules/@syncfusion/ej2-buttons/styles/material.css";
@import "../node_modules/@syncfusion/ej2-popups/styles/material.css";
@import "../node_modules/@syncfusion/ej2-interactive-chat/styles/material.css";
@import "../node_modules/@syncfusion/ej2-splitbuttons/styles/material.css";
</style><template>
<div id='container' style="height: 380px; width: 450px; margin: 0 auto;">
<ejs-chatui :user="currentUser" :showTimeBreak="true">
<e-messages>
<e-message :author="currentUser" text="Hi Michale, are we on track for the deadline?" :timeStamp="new Date('December 25, 2024 7:30')"></e-message>
<e-message :author="michaleUser" text="Yes, the design phase is complete." :timeStamp="new Date('December 25, 2024 8:00')"></e-message>
<e-message :author="currentUser" text="I’ll review it and send feedback by today." :timeStamp="new Date('December 25, 2024 11:00')"></e-message>
</e-messages>
</ejs-chatui>
</div>
</template>
<script>
import { ChatUIComponent, MessagesDirective, MessageDirective } from "@syncfusion/ej2-vue-interactive-chat";
export default {
components: {
'ejs-chatui': ChatUIComponent,
'e-messages': MessagesDirective,
'e-message': MessageDirective
},
data() {
return {
currentUser: {
id: "user1",
user: "Albert",
},
michaleUser: {
id: "user2",
user: "Michale Suyama",
}
};
},
};
</script>
<style>
@import "../node_modules/@syncfusion/ej2-base/styles/material.css";
@import "../node_modules/@syncfusion/ej2-inputs/styles/material.css";
@import "../node_modules/@syncfusion/ej2-navigations/styles/material.css";
@import "../node_modules/@syncfusion/ej2-buttons/styles/material.css";
@import "../node_modules/@syncfusion/ej2-popups/styles/material.css";
@import "../node_modules/@syncfusion/ej2-interactive-chat/styles/material.css";
@import "../node_modules/@syncfusion/ej2-splitbuttons/styles/material.css";
</style>Time break template
Refer to the Templates section for more details about the Time break template.