# Poll

Poll whose options turn into result bars once you vote, with percentages that roll in and the leader highlighted. Supports multiple choice and a quiz mode with a right answer.

> Composed · Pro · Forms & Inputs — React Native, Expo Go compatible.

## Install

```bash
npx @lumioui/cli add pro/poll
```

## Import

```tsx
import { Poll } from "@/components/ui/poll/poll";
```

## Variants

- `chat` — Group chat: `npx @lumioui/cli add pro/poll-chat`
- `post` — Social post: `npx @lumioui/cli add pro/poll-post`
- `quiz` — Trivia quiz: `npx @lumioui/cli add pro/poll-quiz`

## Props

| Prop | Type | Notes |
| --- | --- | --- |
| `question?` | `string` | Question shown above the options. |
| `options` | `PollOption[]` | — |
| `vote?` | `string[]` | Controlled vote (option ids). Empty or undefined = not voted yet. |
| `defaultVote?` | `string[]` | Uncontrolled initial vote. |
| `onVote?` | `(ids: string[]) => void` | Fires when the viewer votes (or retracts, with []). |
| `multiple?` | `boolean` | Multiple choice: rows toggle, a Vote button submits. Default false. |
| `closed?` | `boolean` | Voting closed — results only. |
| `correctId?` | `string` | Quiz mode: the right answer, revealed after voting. |
| `allowRetract?` | `boolean` | Show an "Undo" link after voting. Default false. |
| `variant?` | `"fill" | "line"` | fill — bars fill each row (social feeds). line — percentage column with  a thin bar under the label (in-chat). Default "fill". |
| `meta?` | `string` | Footer meta after the vote total, e.g. "2 days left". |
| `formatTotal?` | `(n: number) => string` | Vote-total formatter. Default "1,284 votes". |
| `submitLabel?` | `string` | Multiple-choice submit label. Default "Vote". |
| `className?` | `string` | — |

## Icons rendered

- `check` — /icons.html?i=check

Source: https://lumioui.com/components/poll