Upvote Button

An arrow that fills, shoots up and floats a +1 as the count rolls.

Preview

"use client";

import { UpvoteButton } from "@/components/motion/upvote-button";

export function UpvoteButtonUsage() {
  return <UpvoteButton count={482} />;
}

Install

Add it with the shadcn CLI, or copy the source manually.

$ bunx --bun shadcn add @beui/upvote-button

API Reference

voted?
boolean

Whether the viewer has voted, for controlled use.

Default—
defaultVoted?
boolean

Whether the viewer starts voted when uncontrolled. Default: false

Defaultfalse
onVotedChange?
((voted: boolean) => void)

Called with the next state when the viewer votes or takes it back.

Default—
count
number

Votes from everyone else. The viewer's own vote is added on top.

Default—
orientation?
"vertical" | "horizontal"

Stack the arrow above the count, or place them side by side. Default: "vertical"

Defaultvertical
labels?
Partial<{ upvote: string; }>

Override any built-in string, e.g. for translation.

Default—
sound?
boolean

Play a rising snap on vote and a falling one on unvote. Off by default; a `SoundProvider` can mute it app-wide.

Defaultfalse
className?
string

Classes merged onto the root element.

Default—

Updated