Pro
Vote control
Up and down votes with a rolling score. Choosing the same arrow again clears your vote; the owner saves it optimistically and can revert.
pnpm dlx shadcn@latest add @caliper/vote-controlWhen to use
Use it for
- Feature requests, answers, ideas.
- Ranking by the community.
Skip it when
- Personal preference with no ranking; use reactions or a rating.
Installation
pnpm dlx shadcn@latest add @caliper/vote-control
Adds its 3 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.
Usage
Import it from your copy of the source. The example behind the preview comes with the source. It is built from applyVote and VoteControl.
import { applyVote, VoteControl } from "@/components/ui/vote-control"
The worked example comes with Pro
The 41-line example behind the preview opens here, ready to copy.
- 626 Pro parts, blocks and page templates, all with source
- $149 once, with lifetime updates. No renewal
- A full refund within 14 days if it is not for you
API reference
applyVote
component
No props of its own; it accepts the native props of its root element.
VoteControl
component
Accessibility
It exposes group semantics, with aria-label, aria-pressed, aria-hidden and aria-live kept in step with state. Changes that matter are announced through a live region.
No custom key handling; Tab and the native activation keys do the work.
Motion
It declares no animation in its component source. Any transition comes from its stylesheet, which uses the duration tokens that collapse to instant under prefers-reduced-motion.
Related
- Reaction barEmoji reactions under a message or post. Each chip is a toggle; the count rolls and your chip settles with one small pop. The picker adds a new reaction.
- Roadmap blockA public roadmap in now, next and later. Votes roll the count and move the card to its place in the column, so readers see their vote count.
- RatingStars that are a native radio group: arrows change the value, a pointer previews, half steps when you need them, and a read-only average that says how many ratings it comes from.