KQ-542 · POLL/BARS
Poll Bars
A poll that turns into its own result. Until the reader votes it is a plain radiogroup; the vote reveals the bars, each growing to its share on glide in one cascade while the percentages roll and the total climbs, and the chosen option stamps its check on recoil. Bars are drawn inside the option rows so revealing the results shifts nothing. Up and Down move and vote, Home and End jump to the ends, Space and Enter cast.
KQ-542 · POLL/BARS
Which Fernworks feature should ship first?
1,184votes · pick one
No vote yet · 1,184 votes
Install
One command — the source lands in your repo. Or copy it from the Code tab.
$ pnpm dlx shadcn@latest add @kinetiq/poll-bars
Props
- options
- { id: string; label: string; votes: number }[]
- default —
- Options and their counts, excluding this reader.
- value / defaultValue
- string | null
- default —
- Controlled or initial vote.
- onVote
- (id: string) => void
- default —
- Fires on vote.
- allowChange
- boolean
- default true
- Let the reader move their vote after casting it.
- question
- string
- default —
- The poll question; it labels the radiogroup.
- format
- (value: number) => string
- default en-US thousands
- Formats the vote counts.
| Prop | Type | Default | Description |
|---|---|---|---|
| options | { id: string; label: string; votes: number }[] | — | Options and their counts, excluding this reader. |
| value / defaultValue | string | null | — | Controlled or initial vote. |
| onVote | (id: string) => void | — | Fires on vote. |
| allowChange | boolean | true | Let the reader move their vote after casting it. |
| question | string | — | The poll question; it labels the radiogroup. |
| format | (value: number) => string | en-US thousands | Formats the vote counts. |