Skip to main content

Overview

CometChatPollBubble renders a poll. It is self-extracting: pass the SDK custom message and the bubble derives the question, options, per-option vote counts, total votes, and the logged-in user’s selected option entirely from the message metadata. Selecting an option submits a vote; the bar fills and counts/avatars update.
Live Preview — interact with the poll bubble.Open in Storybook ↗

Usage


Props

message

The custom message containing poll data in its metadata. Drives all extraction. Required.
TypeCometChat.CustomMessage
RequiredYes

alignment

Override incoming/outgoing alignment. Defaults to sender-vs-logged-in-user.
Type"left" | "right"
Defaultderived

disableInteraction

Disable all interaction (e.g. for a thread header preview).
Typeboolean
Defaultfalse

onVoteSubmit

Callback when a vote is submitted successfully.
Type(event: CometChatPollVoteEvent) => void
Defaultundefined

onVoteError

Callback when a vote submission fails.
Type(event: CometChatPollVoteErrorEvent) => void
Defaultundefined

className

Additional CSS class applied to the root element.
Typestring
Defaultundefined

CSS Selectors

TargetSelector
Root.cometchat-poll-bubble
Incoming / outgoing.cometchat-poll-bubble--incoming / .cometchat-poll-bubble--outgoing
Option.cometchat-poll-bubble__option
Option text.cometchat-poll-bubble__option-text
Option count.cometchat-poll-bubble__option-count
Option progress bar.cometchat-poll-bubble__option-progress-bar
Option radio.cometchat-poll-bubble__option-radio
Voter avatars.cometchat-poll-bubble__option-avatars

Next Steps

Polls Plugin

Plugin behavior, context menu, and conversation preview

Sticker Bubble

Render sticker messages

Message Bubble

The wrapper that hosts bubble content

Theming

Customize colors, fonts, and spacing