Skip to content
animorio
IT
All components

Priority button

Buttons, HoverGSAP, CSS onlyMediumCompressed weight: Demo 6.5 KBGSAP 28 KBFreeDownload the zip

One button, one gesture, in the simple style of product interface pieces: the priority button of a task in a project app, with three thin bars, the word and the P key; each tap raises the priority by one bar, which fills from the bottom going a pixel past the top, and the word rolls (Low, Medium, High); past High the three bars close together and become the orange Urgent square with an exclamation mark that draws itself.

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>
<!--
  "Priority 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 Priority button with the bars that rise</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">
    <!-- one button, one gesture: each tap raises the priority of a task by one bar; past High the bars close into Urgent -->
    <button class="prio" type="button" data-prio aria-label="Priority: no priority. Press to raise it">
      <span class="prio__body" data-body>
        <span class="prio__mark" aria-hidden="true">
          <svg class="prio__icon" viewBox="0 0 24 24">
            <g data-bars>
              <g class="prio__bar" data-bar><rect class="prio__track" data-track/><rect class="prio__fill" data-fill/></g>
              <g class="prio__bar" data-bar><rect class="prio__track" data-track/><rect class="prio__fill" data-fill/></g>
              <g class="prio__bar" data-bar><rect class="prio__track" data-track/><rect class="prio__fill" data-fill/></g>
            </g>
            <g data-urgent>
              <rect class="prio__urgent" x="3" y="3" width="18" height="18" rx="4.5"/>
              <path class="prio__bang" data-bang d="M12 7.4V13.2"/>
              <rect class="prio__dot" data-dot x="10.85" y="15.3" width="2.3" height="2.3" rx="0.6"/>
            </g>
          </svg>
        </span>
        <span class="prio__label" data-label aria-hidden="true"></span>
        <span class="prio__rule" aria-hidden="true"></span>
        <kbd class="prio__key" data-key aria-hidden="true">P</kbd>
      </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.

14 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 “Priority 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 button with rounded corners and a thin border: on the left three short bars lying flat like three grey ticks, then the words «No priority», a light vertical rule and the P key drawn like a keyboard key. On tap the button gives a little and comes back on a spring; the three bars stand up one after the other to their three heights, from the shortest to the tallest, and the first one fills with black from the bottom, goes a pixel past the top, settles and hops by a hair. The old word rises away and «Low» comes in from below, narrow, opening on the width axis, while the button springs to the width of the new word. A second tap fills the middle bar («Medium»), a third the tallest («High»). On the fourth the three bars lean towards the centre and vanish, and in their place an orange square snaps open, slightly turned, and straightens; inside, a white exclamation mark draws itself, first the stroke then the dot, and the word becomes «Urgent» in orange as the button’s border warms up. One more tap and the square shrinks away while the three ticks spread back out from the centre: «No priority». Hovering peeks the next bar in from the bottom, like a promise; the P key (with Shift it goes back) and the arrow keys change the priority, and the drawn key dips. Until someone touches it, the button goes round by itself.

How it works

Three bars, two rectangles each

Each bar is an SVG group with two rectangles: underneath the grey track, on top the black fill. GSAP does not tween the attributes but two numbers per bar, the height h and the fill f, and on every frame one function redraws y, height and rx of both rectangles: this way the corner radius stays right even when the bar is a tick two pixels tall.

The pixel past the top

The fill rises to 1 + OVERSHOOT / h, exactly OVERSHOOT pixels above the track whatever the bar’s height, in a quarter of a second with power2.out, then goes back to 1 on an elastic spring. Meanwhile the bar group rises a pixel and a half and falls back: the hop.

The bars closing into Urgent

Past High each bar slides towards the centre by four fifths of its distance, narrows on the x axis and disappears in a tenth of a second; right after, the orange square comes in from 0.45 to 1 with back.out, starting turned by ten degrees. The stroke of the exclamation mark draws with strokeDashoffset, the dot arrives on a spring, and the square’s rx beats once from 4.5 to 5.6 like a stamp settling.

The word coming in narrow

The five words sit in the same grid cell; the old one leaves before the new one arrives, coming in with the wdth axis at 75 and the weight at 420 and landing at 100 and 560 with back.out. The slot springs to the new word’s width, measured at its final shape; the direction of the roll follows the priority’s.

Values to change

NameFileDefaultWhat it changes
ACCENTscript.js#f2541bThe colour of Urgent: the square, the word and the warm border.
LEVELSscript.jsNo priority, Low, Medium, High, UrgentThe five words, from none to urgent, comma separated.
STARTscript.js0The level it starts on: 0 no priority, 4 urgent.
OVERSHOOTscript.js1How many pixels the fill goes past the top of the bar before settling.
SPRINGscript.js1How springy the press and the bars are: 0.4 calm, 2 very bouncy.
SPEEDscript.js1The speed of everything: 2 twice as fast, 0.5 half.
HOLDscript.js1.3How many seconds each level stays when the button goes round by itself.
AUTOscript.jstrueThe button goes round by itself until someone touches it.

Try them in the Playground

When to use it

For the priority of a task, an issue or a ticket in a project management app, a to-do list or the toolbar of a team document: the rising bars tell the level without reading the word, and Urgent stands out from across the room.

On phones

On the phone the button, the bars and the words take their size from the screen (clamp on the shorter side); there is no hover and the P key stays as a sign of the shortcut, everything else is the same.

With reduced motion

Nothing moves: the bars take their height at once and the black fills them with a fade, the Urgent square fades in and out, the words swap in place.

Pitfalls

  • Tweening the height of an SVG rectangle with a fixed rx made the flat tick come out as a squashed oval and then a pill: the rx is recomputed on every frame as the smaller of 1.2 and half the height.
  • With GSAP’s scale instead of the height the corners warped and the overshoot changed from bar to bar: the pixel past the top is computed on the bar’s real height (1 + OVERSHOOT / h).
  • The hover peek tweens the same numbers as the click: on click they are stopped with killTweensOf before starting again, otherwise the peek would bring the freshly filled bar back to zero.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

Tested on 1 November 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