Poll
pollA question to vote on that turns into its results in place: bars grow to each share, the percentages roll and always total 100, and your choice is marked. Single or multiple choice, on real radios and checkboxes.
"use client";
import { Poll } from "@/components/forme/poll/poll";
export function PollDemo() {
return (
<div className="flex w-full flex-wrap items-start justify-center gap-6">
<Poll
question="What should we build next?"
description="One vote. The results show once you have voted."
options={[
{ id: "dark", label: "Scheduled dark mode", description: "Follow the time of day" },
{ id: "offline", label: "Offline drafts", description: "Write without a connection" },
{ id: "export", label: "CSV export", description: "Every table, one click" },
]}
votes={{ dark: 128, offline: 214, export: 96 }}
onVote={() => new Promise((resolve) => setTimeout(resolve, 600))}
/>
<Poll
multiple
question="Which integrations do you use?"
options={[
{ id: "slack", label: "Slack" },
{ id: "linear", label: "Linear" },
{ id: "github", label: "GitHub" },
{ id: "notion", label: "Notion" },
]}
votes={{ slack: 61, linear: 38, github: 77, notion: 24 }}
defaultValue={["github", "linear"]}
defaultVoted
/>
</div>
);
}Install
Adds the component, its registry dependencies, and the token stylesheet you import once.
API reference
Read from the source, so it is the API of the file you install. A prop marked * is required.
Poll
A question with a vote, and what everyone said.
| Prop | Type | Default | Description |
|---|---|---|---|
question* | ReactNode | — | |
options* | readonly PollOption[] | — | |
description | ReactNode | — | |
votes | Readonly<Record<string, number>> | {} | Everyone else's votes, by option id. The poll counts the person's own vote itself, so the bars move the moment they vote rather than after a round trip. |
multiple | boolean | false | Allow more than one choice: checkboxes instead of radios. |
defaultValue | readonly string[] | [] | The person's choice, for a poll they have already answered. |
defaultVoted | boolean | false | Start on the results: they voted in an earlier visit. |
showResults | boolean | false | Show the results before voting, too. |
onVote | (ids: string[]) => void | Promise<void> | — | Called with the chosen ids. Return a promise and the button waits for it. |
submitLabel | string | "Vote" | |
className | string | — |
Related


Checkbox
A single choice with a visible label wired to it for a screen reader. An indeterminate state for a select-all with only some rows picked, a description read as a description rather than folded into the name, a destructive variant, and a mark that draws itself in.
forms

Radio group
A choice of exactly one option. The selected dot travels between options on a spring, each option carries its own label and optional description, and arrow keys move the selection in the direction the options are laid out.
formsCombobox
A text field that filters a list as you type, with one value chosen from the results. Composable parts, so the field can hold a plain value, an object with a label, or several of either. Filtering, keyboard navigation and the active option being announced all come from Base UI.
forms