Skip to content
Calm motion: animations on this site only fade, with no movement

Poll ​

One-question vote with results

A question with a few answers, and the results after a person votes. Use it for a quick check of opinion. For a long form with many questions, use Questionnaire.

Basic
Tabs or spaces?
Closed poll
  • Tabs44% · 18 votes
  • Spaces34% · 14 votes
  • Either, if the formatter runs22% · 9 votes
  • Before the vote, the poll is a radio group and a Vote button. The button waits for a choice.
  • v-model holds the value that this person voted for. When it is set, or when closed is true, the poll shows the results. Set it from storage to show the results to a person who already voted.
  • vote fires with the value. The poll does not count votes. Your server counts them, and you pass the new totals in options[].votes. Votes include the vote of this person.
  • Each result shows the percent and the number of votes, as text. A screen reader gets the same text as the bars. The bar of your own vote takes the accent color, because color means chosen.
  • labels replaces the English words: vote, yours, and votes(n) for the plural.

Usage ​

ts
import { BlessPoll } from "blessing-ui";

API ​

Props

NameTypeDefaultDescription
question*string—
options*BlessPollOption[]—
closedboolean—no more votes: show the results to everyone
labelsPartial<{ vote: string; yours: string; votes: (n: number) => string; }>—
modelValuestring—the value this person voted for. Set it to show the results.

Events

NamePayloadDescription
update:modelValue[value: string | undefined]
vote[value: string]

Released under the MIT License. Character names and artwork belong to their owners.