Components
An interactive poll where clicking an option reveals animated result bars, vote percentages, and the winning choice.

"use client";
import { PollResults, type PollOption } from "@/components/ui/poll-results";
import { useState } from "react";
const SEED: PollOption[] = [
{ id: "oak", label: "Oak, oiled", votes: 54 },
{ id: "travertine", label: "Travertine", votes: 41 },
{ id: "brick", label: "Painted brick", votes: 17 },
{ id: "concrete", label: "Concrete, sealed", votes: 9 },
];
export function PollResultsDemo() {
const [options, setOptions] = useState(SEED);
return (
<div className="mx-auto w-full max-w-[340px]">
<PollResults
label="Floor for the front room?"
options={options}
onVote={(id) =>
setOptions((prev) =>
prev.map((o) => (o.id === id ? { ...o, votes: o.votes + 1 } : o)),
)
}
/>
</div>
);
}
export default PollResultsDemo;
Part of interior.dev — browse the full library on 21st.dev.