Appearance in React Chat UI component
28 Aug 202516 minutes to read
Setting placeholder
The placeholder property sets the hint text displayed in the message input field to guide users. The default value is Type your message….
import { ChatUIComponent, MessagesDirective, MessageDirective } from '@syncfusion/ej2-react-interactive-chat';
import * as React from 'react';
import * as ReactDOM from "react-dom";
function App() {
const currentUserModel = {
id: "user1",
user: "Albert"
};
const michaleUserModel = {
id: "user2",
user: "Michale Suyama"
};
return (
// specifies the tag for render the Chat UI component
<ChatUIComponent placeholder="Start typing..." user={currentUserModel}>
<MessagesDirective>
<MessageDirective text="Hi Michale, are we on track for the deadline?" author={currentUserModel} ></MessageDirective>
<MessageDirective text="Yes, the design phase is complete." author={michaleUserModel} ></MessageDirective>
<MessageDirective text="I’ll review it and send feedback by today." author={currentUserModel} ></MessageDirective>
</MessagesDirective>
</ChatUIComponent>
);
}
ReactDOM.render(<App />, document.getElementById('container'));import { ChatUIComponent, MessagesDirective, MessageDirective, UserModel } from '@syncfusion/ej2-react-interactive-chat';
import * as React from 'react';
import * as ReactDOM from "react-dom";
function App() {
const currentUserModel: UserModel = {
id: "user1",
user: "Albert"
};
const michaleUserModel: UserModel = {
id: "user2",
user: "Michale Suyama"
};
return (
// specifies the tag for render the Chat UI component
<ChatUIComponent placeholder="Start typing..." user={currentUserModel}>
<MessagesDirective>
<MessageDirective text="Hi Michale, are we on track for the deadline?" author={currentUserModel} ></MessageDirective>
<MessageDirective text="Yes, the design phase is complete." author={michaleUserModel} ></MessageDirective>
<MessageDirective text="I’ll review it and send feedback by today." author={currentUserModel} ></MessageDirective>
</MessagesDirective>
</ChatUIComponent>
);
}
ReactDOM.render(<App />, document.getElementById('container'));Setting width
The width property allows you to define the width of the Chat component. The default value is 100%.
import { ChatUIComponent, MessagesDirective, MessageDirective } from '@syncfusion/ej2-react-interactive-chat';
import * as React from 'react';
import * as ReactDOM from "react-dom";
function App() {
const currentUserModel = {
id: "user1",
user: "Albert"
};
const michaleUserModel = {
id: "user2",
user: "Michale Suyama"
};
return (
// specifies the tag for render the Chat UI component
<ChatUIComponent width="450px" user={currentUserModel}>
<MessagesDirective>
<MessageDirective text="Hi Michale, are we on track for the deadline?" author={currentUserModel} ></MessageDirective>
<MessageDirective text="Yes, the design phase is complete." author={michaleUserModel} ></MessageDirective>
<MessageDirective text="I’ll review it and send feedback by today." author={currentUserModel} ></MessageDirective>
</MessagesDirective>
</ChatUIComponent>
);
}
ReactDOM.render(<App />, document.getElementById('container'));import { ChatUIComponent, MessagesDirective, MessageDirective, UserModel } from '@syncfusion/ej2-react-interactive-chat';
import * as React from 'react';
import * as ReactDOM from "react-dom";
function App() {
const currentUserModel: UserModel = {
id: "user1",
user: "Albert"
};
const michaleUserModel: UserModel = {
id: "user2",
user: "Michale Suyama"
};
return (
// specifies the tag for render the Chat UI component
<ChatUIComponent width="450px" user={currentUserModel}>
<MessagesDirective>
<MessageDirective text="Hi Michale, are we on track for the deadline?" author={currentUserModel} ></MessageDirective>
<MessageDirective text="Yes, the design phase is complete." author={michaleUserModel} ></MessageDirective>
<MessageDirective text="I’ll review it and send feedback by today." author={currentUserModel} ></MessageDirective>
</MessagesDirective>
</ChatUIComponent>
);
}
ReactDOM.render(<App />, document.getElementById('container'));Setting height
The height property allows you to define the height of the Chat component. The default value is 100%.
import { ChatUIComponent, MessagesDirective, MessageDirective } from '@syncfusion/ej2-react-interactive-chat';
import * as React from 'react';
import * as ReactDOM from "react-dom";
function App() {
const currentUserModel = {
id: "user1",
user: "Albert"
};
const michaleUserModel = {
id: "user2",
user: "Michale Suyama"
};
return (
// specifies the tag for render the Chat UI component
<ChatUIComponent height="380px" user={currentUserModel}>
<MessagesDirective>
<MessageDirective text="Hi Michale, are we on track for the deadline?" author={currentUserModel} ></MessageDirective>
<MessageDirective text="Yes, the design phase is complete." author={michaleUserModel} ></MessageDirective>
<MessageDirective text="I’ll review it and send feedback by today." author={currentUserModel} ></MessageDirective>
</MessagesDirective>
</ChatUIComponent>
);
}
ReactDOM.render(<App />, document.getElementById('container'));import { ChatUIComponent, MessagesDirective, MessageDirective, UserModel } from '@syncfusion/ej2-react-interactive-chat';
import * as React from 'react';
import * as ReactDOM from "react-dom";
function App() {
const currentUserModel: UserModel = {
id: "user1",
user: "Albert"
};
const michaleUserModel: UserModel = {
id: "user2",
user: "Michale Suyama"
};
return (
// specifies the tag for render the Chat UI component
<ChatUIComponent height="380px" user={currentUserModel}>
<MessagesDirective>
<MessageDirective text="Hi Michale, are we on track for the deadline?" author={currentUserModel} ></MessageDirective>
<MessageDirective text="Yes, the design phase is complete." author={michaleUserModel} ></MessageDirective>
<MessageDirective text="I’ll review it and send feedback by today." author={currentUserModel} ></MessageDirective>
</MessagesDirective>
</ChatUIComponent>
);
}
ReactDOM.render(<App />, document.getElementById('container'));CSS Class
The cssClass property allows you to apply custom CSS styles to the Chat component for a unique appearance.
import { ChatUIComponent, MessagesDirective, MessageDirective } from '@syncfusion/ej2-react-interactive-chat';
import * as React from 'react';
import * as ReactDOM from "react-dom";
function App() {
const currentUserModel = {
id: "user1",
user: "Albert"
};
const michaleUserModel = {
id: "user2",
user: "Michale Suyama"
};
return (
// specifies the tag for render the Chat UI component
<ChatUIComponent cssClass="custom-container" user={currentUserModel}>
<MessagesDirective>
<MessageDirective text="Hi Michale, are we on track for the deadline?" author={currentUserModel} ></MessageDirective>
<MessageDirective text="Yes, the design phase is complete." author={michaleUserModel} ></MessageDirective>
<MessageDirective text="I’ll review it and send feedback by today." author={currentUserModel} ></MessageDirective>
</MessagesDirective>
</ChatUIComponent>
);
}
ReactDOM.render(<App />, document.getElementById('container'));import { ChatUIComponent, MessagesDirective, MessageDirective, UserModel } from '@syncfusion/ej2-react-interactive-chat';
import * as React from 'react';
import * as ReactDOM from "react-dom";
function App() {
const currentUserModel: UserModel = {
id: "user1",
user: "Albert"
};
const michaleUserModel: UserModel = {
id: "user2",
user: "Michale Suyama"
};
return (
// specifies the tag for render the Chat UI component
<ChatUIComponent cssClass="custom-container" user={currentUserModel}>
<MessagesDirective>
<MessageDirective text="Hi Michale, are we on track for the deadline?" author={currentUserModel} ></MessageDirective>
<MessageDirective text="Yes, the design phase is complete." author={michaleUserModel} ></MessageDirective>
<MessageDirective text="I’ll review it and send feedback by today." author={currentUserModel} ></MessageDirective>
</MessagesDirective>
</ChatUIComponent>
);
}
ReactDOM.render(<App />, document.getElementById('container'));#loader {
color: #008cff;
height: 40px;
left: 45%;
position: absolute;
top: 45%;
width: 30%;
}
#container {
margin: 20px auto;
}
.custom-container {
border-color: #e0e0e0;
background-color: #f4f4f4;
box-shadow: 3px 3px 10px 0px rgba(0, 0, 0, 0.2);
}
.custom-container .e-chat-header {
background: #0c888e;
}
.custom-container .e-footer .e-input-group {
border: 3px solid #bde0e2;
}