Poll
A question with a few answers. Before voting the answers are a plain list of buttons; choosing one reveals the results, each bar growing to its share, your vote ticked and the leader in bold, with Change vote to take it back.
Where should we go in March?
22 votes· Closes Friday
When to use
- Quick decisions in a team space: an offsite, a release name, a meeting time.
- Community posts where seeing others' answers is the point.
When not to use
- Forms where the answer must be validated or stored per person; use radio buttons.
- Ranking or many questions; use a survey.
Installation
pnpm dlx shadcn@latest add @caliper/poll
Adds its 2 files to components/ui/, each with its own stylesheet, and installs their packages. Pro installs with your access token, set up once per project. See Pro access. The first part also adds Caliper UI’s tokens; import them once as in Installation.
API reference
Poll
7 props
Also accepts the native props of its root element and a ref.
Keyboard
- No custom key handling; Tab and the native activation keys do the work.
Accessibility
It is built on native elements and keeps aria-labelledby, aria-hidden, aria-label and aria-live in step with state. Changes that matter are announced through a live region.
Notes for AI
Give your coding assistant this page as Markdown instead of screenshots: the props, keyboard and examples in one file.
/docs/components/poll.mdThe index of every part is at /llms.txt.