Skip to content
caliper ui docs

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.

Pro
pnpm dlx shadcn@latest add @caliper/vote-control

Feature requests

Most wanted by Northwind customers in October

  • Score 214
    Dark mode for the editorEditor
  • Score 98
    Scheduled CSV exportsExports
  • Score 57
    SSO for the Team planSecurity
Installs components/ui/vote-control.tsxDepends on lucide-reactMotion none in component source

When 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

terminal
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.

example.tsx
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
Checking your licence…

API reference

applyVote

component

No props of its own; it accepts the native props of its root element.

VoteControl

component
PropTypeDefaultDescription
score *number—Score including the viewer's current vote.
vote *Vote—
onVote *(next: Vote, score: number) => void—
label *string—What is being voted on, e.g. "Dark mode for the editor".
orientation"horizontal" | "vertical""vertical"
downvotesbooleantrue
classNamestring—

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.

All Actions examples