Skip to main content
Version: v4

List

CometChatList contains one to three lines of text optionally flanked by icons or other widgets, such as CometChatAvatar, CometChatDate or Text. CometChatAvatar will always be shown in the leading view therefore either one among the avatarURL or avatarName must be provided. The icons (or other widgets) for the list item are defined with the tailView parameter. The first line of text is optional and is specified with title. The value of subtitle is also optional, will occupy the space allocated for an additional line of text or some other widget.

This element is used to display rows of information, such as a contact list, playlist, or menu. They contain Avatar, Status indicator, title, subtitle, tailView and menuView.

Properties

NameTypeDescription
idstringUnique identifier of the element
avatarURLstringImage URL for each row item
avatarNamestringFallback name for the avatar of each row item
statusIndicatorColorstringBackground color of the indicator
statusIndicatorIconstringBackground icon of the indicator
titlestringHeading text of each row item
isActivebooleanWhen set to true, sets the particular row item in the active status
hideSeparatorbooleanWhen set to true, hides the separator between each individual items
avatarStyleavatarStyleStyling properties and values of the avatar element
statusIndicatorStylestatusIndicatorStyleStyling properties and values of the status indicator element
listItemStyleListItemStyleStyling properties and values of the element

ListStyle

Styling properties and values of the element

NameDescription
widthSets the width of the element
heightSets the height of the element
borderSets the border of the element
borderRadiusSets the border radius of the element
backgroundSets all background style properties at once, such as color, image, origin and size, or repeat method. Reference link
paddingSets the padding area on all four sides of the component
titleFontSets all the different properties of font for the heading text. Reference link
titleColorSets the foreground color of heading text.
separatorColorSets the background style properties for the separator between the individual items. Reference link
activeBackgroundSets the background style properties of the element when in active state Reference link
hoverBackgroundSets the background style properties of the element on mouseover Reference link

Slots

Placeholder areas within the element's template

NameDescription
subtitleViewPlaceholder to display the secondary title. For e.g. Last message in recent chats OR members count of a group
tailViewPlaceholder to display the view on the extreme right of the row. For e.g. Unread count as a badge in recent chats
menuViewPlaceholder to display the view on mouseover. For e.g. Delete conversation option in recent chats

Events

Events dispatched from the element

NameDescription
cc-listitem-clickedEvent triggered when user clicks on each element

Usage

import "@cometchat/chat-uikit-vue"; //import the web elements package.

const clickHandler = event => {
console.log(event.detail.id )
}

//use the component
<CometChatListItem @cc-listitem-clicked={clickHandler($event)}></CometChatListItem>