Skip to main content

Message List

List Messages

Of course we need to list the messages. Using the Message List component is not difficult at all.

Emre
Hi there !
Esra
Hii !
Kursat
Heyy ! How are you ?

Example Usage

import { MessageList } from "react-chat-elements"

<MessageList
className='message-list'
lockable={true}
toBottomHeight={'100%'}
dataSource={[
{
position:"left",
type:"text",
title:"Kursat",
text:"Give me a message list example !",
},
{
position:"right",
type:"text",
title:"Emre",
text:"That's all.",
},
]}
/>

Result

Kursat
Give me a message list example !
Emre
That's all.

Message List Props

propdefaulttypedescription
referancenoneobjectmessage list ref
classNamenonestringoptional message list className
customPropsnoneobjectmessage list customProps {[key:string]: unknown}
childrennoneReactChildmessage list children
isShowChildnonebooleanmessage list child show control
dataSource[]arraymessage box array (see details below)
lockablefalsebooleanIt locks to scroll position when the dataSource has been changed
toBottomHeight300int or string(only '100%')If the toBottomHeight property's value higher than bottom value of the scrollbar when the data source has been changed Scrollbar goes to bottom at the end of the page. If the toBottomHeight property's value has been set '100%', scrollbar goes to bottom at the end of the page when the data source has been changed.
onClicknonefunctionmessage list item on click (message(object) is returned)
onOpennonefunctionmessage list item on open (file or photo) (message(object) is returned)
onDownloadnonefunctionmessage list item on download (file or photo) (message(object) is returned)
onScrollnonefunctionmessage list onScroll event
onForwardClicknonefunctionmessage list item onForwardClick event
onReplyClicknonefunctionmessage list item onReplyClick event
onReplyMessageClicknonefunctionmessage list item onReplyMessageClick event
downButtontruebooleanmessage list scroll to bottom button
downButtonBadgenonebooleanmessage list downButton badge content
onDownButtonClicknonefunctionmessage list onDownButtonClick
onContextMenunonefunctionmessage list item onContextMenu event, gets 3 parameters: message item, index of item, event
onPhotoErrornonefunctionmessage list item on error photo
onMeetingMoreSelectnonefunctionmessage list on meeting more select event
onMessageFocusednonefunctionmessage list on message focus event
onTitleClicknonefunctionmessage list on title click event
onRemoveMessageClicknonefunctionmessage list on remove message click event
onMeetingMessageClicknonefunctionmessage list on meeting message click event
onMeetingTitleClicknonefunctionmessage list on meeting title click event
onMeetingVideoLinkClicknonefunctionmessage list on meeting video link click event
onMeetingLinkClicknonefunctionmessage list on meeting link click event

MessageList dataSource Props

typeprops details
textText Message Props
locationLocation Message Props
photoPhoto Message Props
videoVideo Message Props
meetingMeeting Message Props
systemSystem Message Props
fileFile Message Props
meetingLinkMeeting Link Message Props
audioAudio Message Props
spotifySpotify Message Props