Componentmedia0.95 KB gzipZero dependencies
Poll
Interactive poll with animated result bars and vote confirmation.
Preview
Live Preview
Installation
Tokens guide →Add to your project via CLI (zero dependencies, code you own):
npx bigbullui add pollOr install the full npm package:
npm install bigbulluiUsage
tsx3 lines
import { Poll } from "@/components/ui/poll"; <Poll />Source code
poll.tsx + 1 helperZero third-party dependencies (2 local files shown in tabs below).
tsxpoll.tsx82 lines
"use client"; import * as React from "react";import { cn } from "./lib/utils"; export interface PollOption { id: string; label: string; /** Vote count used to calculate percentage */ votes: number;} export interface PollProps extends React.HTMLAttributes<HTMLDivElement> { question: string; options: PollOption[]; /** ID of the voted option if already cast */ votedId?: string; onVote?: (optionId: string) => void;Props
Interactive Prop Playground
Tweak parsed AST props below to generate ready-to-paste JSX.
tsx3 lines
import { Poll } from "@/components/ui/poll"; <Poll />| Prop | Type | Description |
|---|---|---|
| question | string | Configures question. (Default: "") |
| options | PollOption[] | Selectable options list. (Default: []) |
| votedId | string | ID of the voted option if already cast |
| onVote | (optionId: string) => void | Callback invoked on vote. |