Skip to content
animorio
IT
All components

Upvote button

Buttons, HoverGSAP, CSS onlyEasyCompressed weight: Demo 5.4 KBGSAP 28 KBFreeDownload the zip

One button, one gesture, in the simple style of product interface pieces: the white «Upvote» pill of a launch page, with an arrow drawn in a thin line and the vote count; on tap the arrow rises a few pixels leaving a thin trail under it, fills from the bottom with the accent colour and comes back down a pixel too far; in the count only the digit that changes rolls and the label becomes «Upvoted». On a second tap the colour drains out and the digit rolls back down.

The code

A folder that runs on its own: index.html, style.css, script.js and the libraries from a CDN. The React and Vue tabs hold the same demo as a ready component, which switches its animations off when it leaves the page.

<!doctype html>
<!--
  "Upvote button" from Animorio · https://animorio.com
  License: free on your own sites and your clients’ sites, paid work included.
  Not for resale, redistribution, templates or code collections · https://animorio.com/en/license/
-->
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>The Upvote button with the arrow that rises</title>
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fontsource-variable/mona-sans@5.3.0/wdth.css">
  <link rel="stylesheet" href="style.css">
</head>
<body>
  <main class="stage" data-stage>
    <!-- one button, one gesture: the thin arrow rises, fills from the bottom and the count ticks up a digit -->
    <button class="vote" type="button" data-vote aria-pressed="false" aria-label="Upvote, 128 votes">
      <span class="vote__body" data-body>
        <span class="vote__mark" aria-hidden="true">
          <svg class="vote__icon" viewBox="4 2 24 28">
            <defs>
              <clipPath id="vote-fill-clip"><rect data-level x="0" y="32" width="32" height="32"/></clipPath>
            </defs>
            <path class="vote__trail" data-trail d="M16 30.5V22.5"/>
            <g data-arrow>
              <path class="vote__fill" clip-path="url(#vote-fill-clip)" d="M16 8.2 24.4 20.4H7.6Z"/>
              <path class="vote__arrow" d="M16 8.2 24.4 20.4H7.6Z"/>
            </g>
          </svg>
        </span>
        <span class="vote__label" data-label aria-hidden="true">
          <span class="vote__word" data-word="off">Upvote</span>
          <span class="vote__word" data-word="on">Upvoted</span>
        </span>
        <span class="vote__rule" aria-hidden="true"></span>
        <span class="vote__count" data-count aria-hidden="true"></span>
      </span>
    </button>
  </main>
  <script src="https://cdn.jsdelivr.net/npm/gsap@3.15.0/dist/gsap.min.js"></script>
  <script src="script.js"></script>
</body>
</html>

Playground

Change values, colours and text with the controls and watch the animation respond live. Or write in the code yourself. Then download the folder with your changes.

16 values to change

Or ask your AI assistant for it

With the Animorio connector, Claude Code, ChatGPT, Cursor or VS Code take it from here, guide included, and fit it into your project. Paste this request:

Take “Upvote button” from Animorio and fit it into my site
Platform licenseFree on your sites and your clients’ sites. Want it inside a website builder, a template platform or a client dashboard? There’s a license for agencies and platforms.

What it does

On white, alone in the middle, there is a white pill with a thin border: on the left a triangle arrow drawn in a thin line, then the word «Upvote», a light vertical rule and the vote count, 128. On tap the pill gives a little and comes back on a spring; the arrow rises a few pixels and a thin trail in the accent colour draws under it, then pulls away from the bottom; as it rises the arrow fills with orange from the base to the tip, then comes back down a pixel past its place before it settles. In the count only the digit that changes rolls: the 8 goes up and away and the 9 arrives from below (with 199 two digits roll, the right one first, like a counter carrying over). The label becomes «Upvoted», coming in narrow and opening on the width axis, and the pill’s border warms up to orange. On a second tap the arrow dips by a hair, the colour drains downwards and the digit rolls back down. Hovering lifts the arrow slightly and the orange peeks in at the base, like a promise. Until someone touches it, the pill plays the gesture by itself.

How it works

One arrow, two paths

The arrow is the same triangle drawn twice: on top the thin outline, underneath the accent fill cut by a clipPath holding a rectangle. The fill rises by animating the rectangle’s y attribute from the base to the tip: the colour grows from the bottom with no masks or gradients.

The rise and the landing

The arrow group rises by LIFT pixels with power3.out in a quarter of a second and goes back to zero with back.out: the ease takes it a pixel below its place and settles it. Below, a short line draws with strokeDashoffset as the arrow rises and pulls away upwards by going to minus its length: that is the trail.

Only the digit that changes

The number is a row of slots, one per digit, each a grid with its digits in the same cell. The old and new numbers are compared right-aligned and only the slot that changes rolls: the old digit leaves upwards, the new one comes in from below with back.out, and the slot springs to the new digit’s width (Mona Sans digits are not all the same width). Several digits start from the right, five hundredths apart.

The word coming in narrow

The old word rises and leaves before the new one arrives, coming up from below with the wdth axis at 75 and the weight at 420 and landing at 100 and 560 with back.out. The pill’s border and tint are two CSS variables tweened by GSAP, so the shadow stays the CSS one.

Values to change

NameFileDefaultWhat it changes
ACCENTscript.js#ff5a1fThe colour that fills the arrow and the count.
LABEL_OFFscript.jsUpvoteThe word before voting.
LABEL_ONscript.jsUpvotedThe word once the vote is in.
COUNTscript.js128The votes before yours: with 199 or 999 more digits roll.
LIFTscript.js5How many pixels the arrow rises on the vote.
SPRINGscript.js1How springy the press and the landing are: 0.4 calm, 2 very bouncy.
SPEEDscript.js1The speed of everything: 2 twice as fast, 0.5 half.
HOLDscript.js2.2How many seconds each state stays when the button plays by itself.
AUTOscript.jstrueThe button plays the gesture by itself until someone touches it.

Try them in the Playground

When to use it

For the vote on a product launch page, a forum, a ranking of ideas or feature requests: the rising arrow and the ticking digit say by themselves that the vote was counted.

On phones

On the phone the pill, the arrow and the words take their size from the screen (clamp on the shorter side); there is no hover, everything else is the same.

With reduced motion

The arrow does not move: the colour fills it with a fade, digits and words swap in place, the pill takes its new width at once.

Pitfalls

  • Mona Sans digits are not all the same width and tabular-nums is not used here (the zero comes out slashed): each slot measures the new digit and springs to it, otherwise a 1 would leave a gap and a 0 would stick out.
  • The fill’s clipPath lives in the path’s user space: the rectangle rises and falls with the arrow, so the colour never lags behind while it lifts.
  • The hover must not touch the arrow while the vote is moving it: with overwrite it would have killed the rise and the fill halfway.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

Compressed with gzip, the three demo files weigh 5.4 KB; the libraries: GSAP 28 KB.

Testing

Tested on 31 October 2026

  • Desktop: Done
  • Phone: Done
  • Reduced motion: Done
  • Safari on iPhone: To do

License

Use it in your own projects and in your clients’ projects. Do not resell it or redistribute it as is. GSAP stays under its own Standard license. Full license.

All components