---
title: "Upvote Button"
description: "A vote toggle that fills with colour from the bottom as the arrow shoots out the top, a +1 floats away and the count rolls up."
category: "Micro Interactions"
publishedAt: "2026-11-16"
updatedAt: "2026-11-25"
documentation: "https://beui.dev/micro-interactions/upvote-button"
markdown: "https://beui.dev/micro-interactions/upvote-button.md"
license: "MIT"
---

# Upvote Button

> A vote toggle that fills with colour from the bottom as the arrow shoots out the top, a +1 floats away and the count rolls up.

## Install

```bash
npx shadcn@latest add @beui/upvote-button
```

## Dependencies

- `clsx`
- `lucide-react`
- `motion`
- `react`
- `tailwind-merge`

## Usage

```tsx
"use client";

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

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

## API Reference

### UpvoteButton

| Prop | Type | Default | Required | Description |
| --- | --- | --- | --- | --- |
| `voted` | `boolean` | — | No | Whether the viewer has voted, for controlled use. |
| `defaultVoted` | `boolean` | `false` | No | Whether the viewer starts voted when uncontrolled. Default: false |
| `onVotedChange` | `((voted: boolean) => void)` | — | No | Called with the next state when the viewer votes or takes it back. |
| `count` | `number` | — | Yes | Votes from everyone else. The viewer's own vote is added on top. |
| `orientation` | `"horizontal" \| "vertical"` | `vertical` | No | Stack the arrow above the count, or place them side by side. Default: "vertical" |
| `labels` | `Partial<{ upvote: string; }>` | — | No | Override any built-in string, e.g. for translation. |
| `sound` | `boolean` | `false` | No | Play a rising snap on vote and a falling one on unvote. Off by default; a `SoundProvider` can mute it app-wide. |
| `className` | `string` | — | No | Classes merged onto the root element. |

## About Upvote Button

Upvote Button is a React vote toggle built with Framer Motion. A vote rises through the button: it fills with the primary colour from the bottom, the arrow shoots out the top as a filled one rises in behind it, a +1 floats away and the count rolls up digit by digit. Taking the vote back drains the fill and runs it all downward. It comes in a vertical layout for launch lists and a horizontal pill for inline use.

### When to use it

- A launch board, feature request list or forum ranks posts by votes.
- A roadmap lets users vote on what ships next.
- A Q and A page lets people upvote the best answer.

### Accessibility

It renders a button with aria-pressed named Upvote, and the count is read from screen reader text. Give each button a unique name in lists through labels. With reduced motion the fill and arrow change at once, the +1 is skipped and digits fade instead of rolling.

### FAQ

**Does count include the viewer's vote?**

No. Pass the votes from everyone else; the button adds one while voted.

**How do I switch to a horizontal layout?**

Set orientation="horizontal" for a compact pill with the arrow and count side by side.

## Source

- Registry detail: https://beui.dev/r/upvote-button
- Raw source: https://beui.dev/r/upvote-button/raw
- GitHub: https://github.com/starc007/ui-components
