Skip to main content
When a group has to pick between options, such as where to eat on Friday, a poll collects votes and shows live counts. The creator closes the poll to announce the winner.
src/app.ts

Factory options

Props, state and actions

Props are { question, closesAt? }. State is { closed, winners?, votes? }, starting at { closed: false }. The vote itself is a viewer input named choice, so Reintersect stores picks and shows live counts. The question is the block’s title, so the choice group carries the shorter vote label (“Your vote”). Only the member who added the poll sees Close poll, because the recipe puts audience="creator" on its Actions. Exported helpers: choiceCounts, closePoll, pollOutcome, PollView, POLL_LABELS, POLL_INITIAL_STATE, PollPropsSchema, PollStateSchema.