> ## Documentation Index
> Fetch the complete documentation index at: https://cometchat-22654f5b-docs-rn-guide-message-privately.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Poll Bubble

> A self-extracting bubble that renders a poll with its question, selectable options, live vote counts, percentages, and voter avatars.

<Accordion title="AI Integration Quick Reference">
  ```json theme={null}
  {
    "component": "CometChatPollBubble",
    "package": "@cometchat/chat-uikit-react",
    "import": "import { CometChatPollBubble } from \"@cometchat/chat-uikit-react\";",
    "description": "Self-extracting poll bubble. Derives the question, options, vote counts, totals, and the logged-in user's vote from the message metadata.",
    "cssRootClass": ".cometchat-poll-bubble",
    "selfExtracting": true,
    "props": {
      "data": {
        "message": { "type": "CometChat.CustomMessage", "required": true, "note": "Contains poll data in its metadata; drives all extraction." },
        "alignment": { "type": "\"left\" | \"right\"", "note": "Defaults to sender-vs-logged-in-user." },
        "disableInteraction": { "type": "boolean", "default": false },
        "onVoteSubmit": { "type": "(event: CometChatPollVoteEvent) => void" },
        "onVoteError": { "type": "(event: CometChatPollVoteErrorEvent) => void" },
        "className": { "type": "string" }
      }
    }
  }
  ```
</Accordion>

## 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.

<Info>
  **Live Preview** — interact with the poll bubble.

  [Open in Storybook ↗](https://storybook.cometchat.io/react/?path=/story/components-bubbles-message-bubble--poll-message)
</Info>

<iframe src="https://storybook.cometchat.io/react/iframe.html?id=components-bubbles-message-bubble--poll-message&viewMode=story&shortcuts=false&singleStory=true" className="w-full rounded-xl" loading="lazy" style={{height: "550px", border: "1px solid #e0e0e0"}} title="CometChat Poll Bubble — Default" allow="clipboard-write" />

***

## Usage

```tsx theme={null}
import { CometChat } from "@cometchat/chat-sdk-javascript";
import { CometChatPollBubble } from "@cometchat/chat-uikit-react";

function PollMessage({ message }: { message: CometChat.CustomMessage }) {
  return (
    <CometChatPollBubble
      message={message}
      onVoteSubmit={(e) => console.log("Voted:", e.optionText)}
    />
  );
}
```

***

## Props

### message

The custom message containing poll data in its metadata. Drives all extraction. **Required.**

|          |                           |
| -------- | ------------------------- |
| Type     | `CometChat.CustomMessage` |
| Required | Yes                       |

***

### alignment

Override incoming/outgoing alignment. Defaults to sender-vs-logged-in-user.

|         |                     |
| ------- | ------------------- |
| Type    | `"left" \| "right"` |
| Default | derived             |

***

### disableInteraction

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

|         |           |
| ------- | --------- |
| Type    | `boolean` |
| Default | `false`   |

***

### onVoteSubmit

Callback when a vote is submitted successfully.

|         |                                           |
| ------- | ----------------------------------------- |
| Type    | `(event: CometChatPollVoteEvent) => void` |
| Default | `undefined`                               |

***

### onVoteError

Callback when a vote submission fails.

|         |                                                |
| ------- | ---------------------------------------------- |
| Type    | `(event: CometChatPollVoteErrorEvent) => void` |
| Default | `undefined`                                    |

***

### className

Additional CSS class applied to the root element.

|         |             |
| ------- | ----------- |
| Type    | `string`    |
| Default | `undefined` |

***

## CSS Selectors

| Target              | Selector                                                                |
| ------------------- | ----------------------------------------------------------------------- |
| 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

<CardGroup cols={2}>
  <Card title="Polls Plugin" icon="square-poll-vertical" href="/ui-kit/react/plugins/overview#built-in-plugins">
    Plugin behavior, context menu, and conversation preview
  </Card>

  <Card title="Sticker Bubble" icon="face-smile" href="/ui-kit/react/components/sticker-bubble">
    Render sticker messages
  </Card>

  <Card title="Message Bubble" icon="comment" href="/ui-kit/react/components/message-bubble">
    The wrapper that hosts bubble content
  </Card>

  <Card title="Theming" icon="paintbrush" href="/ui-kit/react/theming">
    Customize colors, fonts, and spacing
  </Card>
</CardGroup>
