Componentmedia0.95 KB gzipZero dependencies

Poll

Interactive poll with animated result bars and vote confirmation.

Preview

Live Preview
Open ↗

Installation

Tokens guide →

Add to your project via CLI (zero dependencies, code you own):

npx bigbullui add poll

Or install the full npm package:

npm install bigbullui

Usage

tsx3 lines
import { Poll } from "@/components/ui/poll"; <Poll />

Source code

poll.tsx + 1 helper

Zero 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 />
PropTypeDescription
questionstringConfigures question. (Default: "")
optionsPollOption[]Selectable options list. (Default: [])
votedIdstringID of the voted option if already cast
onVote(optionId: string) => voidCallback invoked on vote.