Poll
A component used to render a poll within a MessageList. Needs to be structured inside a Channel component.
It will render its default PollContent, which can be overridden for custom UI. Its children have access to the entire poll state through the usePollState hook.
Best Practices
- Render polls inside
Channelto access poll context and state. - Use
PollContentoverrides for UI changes without rewriting poll logic. - Rely on
usePollStatefor data instead of duplicating poll state. - Handle missing or expired polls gracefully.
- Keep poll UI compact to avoid list clutter.
Props
| Prop | Description | Type |
|---|---|---|
message | Message object. | Message type |
poll * | An instance of the Poll class containing reactive state. Used by usePollContext, usePollStateStore and usePollState hooks. If you need the Poll instance you may get it from client.polls.fromState(pollId). | object |
PollContent | Component used to render the content of the Poll in MessageList. Has full access to the Poll reactive state through the usePollState hook. Defaults to PollContent. Accepts sub-component props PollHeader and PollButtons. | ComponentType |