Skip to content
caliper ui pro docs

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
  • Score 214
    Dark mode for the editorEditor
  • Score 98
    Scheduled CSV exportsExports
  • Score 57
    SSO for the Team planSecurity

When to use

  • Feature requests, answers, ideas.
  • Ranking by the community.

When not to use

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

API reference

applyVote

0 props

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

VoteControl

7 props
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"vertical" | "horizontal""vertical"
downvotesbooleantrue
classNamestring—

Keyboard

  • No custom key handling; Tab and the native activation keys do the work.

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.

Notes for AI

Give your coding assistant this page as Markdown instead of screenshots: the props, keyboard and examples in one file.

/docs/components/vote-control.md

The index of every part is at /llms.txt.

More in Actions