Real-time polling component with single and multiple-choice voting, percentage results, three responsive templates, and the standard sign-in/lead/CTA configuration.
tsx
import { PollVote } from "fansunited-frontend-components";
import { PollVoteProps, WidgetTemplate } from "fansunited-frontend-core";
Prop Type Description entityIdstringPoll identifier. sdkFansUnitedSDKModelSDK instance. templateWidgetTemplateSTANDARD, SPLIT, or OVERLAY.languageLanguageTypeDisplay language.
Prop Type Description themeOptionsCustomThemeOptionsSee Theming . leadsLeadsOptionsSee Lead Collection . imagePosition"left" | "right"STANDARD template only.defaultImagePlaceholderUrlstringFallback image URL. userIsLoggedInbooleanHost auth state for sign-in-gated polls. signInCTASignInCTADetailsSee Sign-in CTA . additionalCTAAdditionalCTADetailsSee Additional CTA . rulesDisplayRulesDisplaySee Rules Display .
Single or multiple choice is determined by the poll configuration on the backend.
Vote attempt limits are enforced server-side. The component disables the form once a user has reached the limit and shows the results view instead.
Real-time results are fetched after a successful vote and updated on the results screen.
tsx
<PollVote
entityId="poll-123"
sdk={sdk}
template={WidgetTemplate.STANDARD}
language="en"
/>
tsx
<PollVote
entityId="poll-123"
sdk={sdk}
template={WidgetTemplate.OVERLAY}
language="en"
userIsLoggedIn={false}
signInCTA={{ defaultLabel: "Sign in to vote", onClick: openSignIn }}
leads={{
position: "after",
fields: ["fullName", "email"],
campaignId: "poll-campaign",
campaignName: "User Survey 2024",
syncWithProfile: true,
}}
themeOptions={{ mode: "dark" }}
/>