Polls

Stream Chat’s UI Component SDK offers the capability to create polls within your chat application. Polls are an effective tool for enhancing user interaction and engagement, providing a dynamic way to gather opinions and feedback from users. This feature allows you to seamlessly integrate interactive polls, making your chat application more engaging and interactive.

Polls on UI Components are available since version 6.5.0.

Polls are disabled by default. To enable this feature, navigate to the Stream dashboard for your app and enable the Polls flag for your channel type.

Polls Dashboard

Once you enable that feature, an additional “Polls” icon will appear in the attachment picker within the default composer of the SDK.

Poll attachment

Poll Configurations

When you tap the “Polls” icon, a new screen for creating polls will be displayed. Here, you can set up the poll title, the options, and various settings such as the maximum number of votes, whether the poll is anonymous, and if it allows comments. This allows for a customized polling experience within the app.

Poll Configurations

You can determine which options users can configure when creating a poll by providing your own PollsConfig. For instance, you can create a configuration that hides the “Comments” option and allows multiple votes by default. This customization ensures that the polling experience aligns with the desired usage and interaction patterns within your application.

The MessageComposer allows you to intercept the PollsConfig the user has defined to create the poll by setting a listener on the property pollSubmissionListener. You can use our MessageComposerViewModel.bindView() method to bind the MessageComposer with the MessageComposerViewModel.

PollView

Poll View

The PollView displays the poll question and answer options, distinguishing between the poll owner and other users. It allows user interaction, showing real-time vote counts and participants, along with the question title, answer items, and additional option buttons.

It is implemented inside the MessageListView, so you can set custom listeners for any action the user does over the poll. You can use our MessageListViewModel.bindView() method to bind the PollView with the MessageListViewModel

© Getstream.io, Inc. All Rights Reserved.