# Poll

A component used to render a poll within a `MessageList`. Needs to be structured inside a [`Channel` component](https://getstream.io/chat/docs/sdk/react-native/core-components/channel/).

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 `Channel` to access poll context and state.
- Use `PollContent` overrides for UI changes without rewriting poll logic.
- Rely on `usePollState` for 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](https://github.com/GetStream/stream-chat-js/blob/master/src/poll.ts) 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`       |

## UI Component Overrides

The `PollContent` UI component is not passed as a prop on `Poll`. Instead, override it through the [`WithComponents`](https://getstream.io/chat/docs/sdk/react-native/customization/custom-components/) provider higher in the tree; the component reads it from `useComponentsContext()`.

```tsx
import { WithComponents, Channel } from "stream-chat-react-native";

<WithComponents overrides={{ PollContent: MyPollContent }}>
  <Channel channel={channel}>{/* MessageList renders Poll */}</Channel>
</WithComponents>;
```

| Override      | Description                                                                                                                                                                                                                                                                                                                                       | Type            |
| ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------- |
| `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`](https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/Poll/Poll.tsx). Accepts sub-component props `PollHeader` and `PollButtons`. | `ComponentType` |

---

For the most recent version of this documentation, visit [https://getstream.io/chat/docs/sdk/react-native/ui-components/poll/](https://getstream.io/chat/docs/sdk/react-native/ui-components/poll/).