Skip to main content

Chat Item

Chat Component

Items in the ChatList can also be defined separately.

emre_avatar
Emre
just now
What are you doing ?

Example Usage

import { ChatItem } from "react-chat-elements";

<ChatItem
avatar="https://avatars.githubusercontent.com/u/80540635?v=4"
alt="kursat_avatar"
title="Kursat"
subtitle="Ok. See you !"
date={new Date()}
unread={0}
/>;
<ChatItem
avatar="https://avatars.githubusercontent.com/u/41473129?v=4"
alt="kursat_avatar"
title="Emre"
subtitle="What are you doing ?"
date={new Date()}
muted={true}
showMute={true}
showVideoCall={true}
unread={2}
/>;

Result

kursat_avatar
Kursat
just now
Ok. See you !
kursat_avatar
Emre
just now
What are you doing ?
2

Chat Item Props

propdefaulttypedescription
idnonestring | numberChatItem id
classNamenonestringclassName for optional ChatItem
avatarnonestringChatItem avatar photo url
avatarFlexiblefalsebooleanflexible ChatItem avatar photo
letterItemnoneobjectAvatar letter item
altnonestringChatItem avatar photo alt text
titlenonestringChatItem title
subtitlenonestringChatItem subtitle
datenonedateChatItem date
dateStringnonestringChatItem represents dateString or timeagojs(now, date)
unread0intChatItem unread count
onClicknonefunctionChatItem on click
onContextMenunonefunctionChatItem on context menu
statusColornonestringChatItem status color
statusColorTypebadgestringChatItem status color type (encircle, badge)
statusTextnonestringChatItem status text
lazyLoadingImagenoneimage pathlazy loading image
mutedfalseboolchat mute info
showMutefalseboolchat mute button visibilty
showVideoCallfalseboolchat video call button visibilty
onClickMutenonefunctionmute button
onClickVideoCallnonefunctionvideo call button
onAvatarErrornonefunctiononerror event for avatar (img)
onDragOvernonefunctionondragover event
onDragEnternonefunctionondragenter event
onDropnonefunctionondrop event
onDragLeavenonefunctionondragleave event
onDragComponentnonefunctionthe component which showing while drag