Skip to content
animorio
IT
All components

Neumorphic button

Buttons, Hover, TransitionsGSAP, CSS onlyMediumCompressed weight: Demo 6.6 KBGSAP 28 KBFreeDownload the zip

Someone searched for “neumorphism” and the library had nothing in that style. The power button of the living room light in a made-up smart home panel, in neumorphic style (soft UI): made of the same light grey paper as the background, raised by two soft shadows, a light one top left and a dark one bottom right. On hover it lifts and the shadows stretch; pressed, the shadows move inside and it becomes a hollow, the power icon lights up amber, a thin ring of light runs round the rim of the well and the label rolls from Off to On while the brightness climbs to 80%. Beside it its two smaller siblings, Dim and Timer, in the same style: Dim presses and comes back up dimming the light to 40%, Timer stays down and adds “30 min”. Pressed again, the button rises back into relief on a spring.

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>
<!--
  "Neumorphic 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>Neumorphic button</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">
    <!-- the power button of a made-up smart home panel, soft UI style: made of the same paper as the background,
         raised with two soft shadows; pressed, the shadows move inside, the icon lights up and a ring of light
         fills the rim of the well; Dim and Timer are its two smaller siblings -->
    <div class="panel" data-panel>
      <button class="neu pill" type="button" data-power aria-pressed="false" data-autoclic>
        <span class="neu__face neu__face--up" aria-hidden="true"></span>
        <span class="neu__face neu__face--down" data-down aria-hidden="true"></span>
        <span class="pill__glow" data-glow aria-hidden="true"></span>
        <span class="pill__in" data-in>
          <span class="well" aria-hidden="true">
            <span class="well__warm" data-warm></span>
            <svg class="ring" viewBox="0 0 52 52" aria-hidden="true">
              <circle class="ring__track" cx="26" cy="26" r="24"></circle>
              <circle class="ring__light" cx="26" cy="26" r="24" pathLength="1" data-ring></circle>
            </svg>
            <svg class="power" viewBox="0 0 24 24" data-icon aria-hidden="true">
              <path class="power__arc" d="M7.05 7.4a7 7 0 1 0 9.9 0"></path>
              <path class="power__bar" d="M12 4.2v7.2" data-bar></path>
            </svg>
          </span>
          <span class="pill__text">
            <span class="pill__name" data-name>Living room light</span>
            <span class="status" data-status aria-hidden="true"><span class="status__line">Off</span></span>
          </span>
        </span>
      </button>

      <div class="sibs">
        <button class="neu sib" type="button" data-dim aria-label="Dim" title="Dim" aria-disabled="true">
          <span class="neu__face neu__face--up" aria-hidden="true"></span>
          <span class="neu__face neu__face--down" aria-hidden="true"></span>
          <svg class="sib__icon" viewBox="0 0 24 24" aria-hidden="true">
            <circle class="dim__core" cx="12" cy="12" r="3.6"></circle>
            <path class="dim__half" d="M12 8.4a3.6 3.6 0 0 1 0 7.2z"></path>
            <g class="dim__rays" data-rays>
              <path d="M12 3.4v1.8M12 18.8v1.8M3.4 12h1.8M18.8 12h1.8M5.9 5.9l1.3 1.3M16.8 16.8l1.3 1.3M5.9 18.1l1.3-1.3M16.8 7.2l1.3-1.3"></path>
            </g>
          </svg>
        </button>
        <button class="neu sib" type="button" data-timer aria-label="Timer" title="Timer" aria-pressed="false" aria-disabled="true">
          <span class="neu__face neu__face--up" aria-hidden="true"></span>
          <span class="neu__face neu__face--down" aria-hidden="true"></span>
          <svg class="sib__icon" viewBox="0 0 24 24" aria-hidden="true">
            <circle class="clock__rim" cx="12" cy="13" r="7.2"></circle>
            <path class="clock__top" d="M10 3.6h4"></path>
            <path class="clock__hand" d="M12 13V8.6" data-hand></path>
          </svg>
        </button>
      </div>
    </div>
    <p class="sr" aria-live="polite" data-live></p>
  </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.

19 values to change

Works with Claude, Claude Code, ChatGPT, Cursor, VS Code, Windsurf, Codex, Gemini CLI

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 “Neumorphic 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 a cool light grey background, three buttons made of the same paper as the background: they stand out only through their shadows, a light one top left and a dark one bottom right, and a veil of light on the face. The first is a pill 64 pixels tall: on the left a round hollow well with the drawn power icon, beside it “Living room light” and below the state, Off. On hover the pill rises a pixel and the shadows stretch. Pressed, the outer shadows shorten until they vanish and the inner ones grow straight away: the pill becomes a hollow, the face goes from domed to concave, the icon’s bar dips a little and the icon turns amber with a still halo; a thin amber ring starts at the top and runs round the rim of the well, swells slightly as it closes and settles; a warm light comes on in the well and over the pill. The status line rolls up from Off to “On · 80%”, with the percentage climbing digit by digit. The two round siblings, Dim with a half sun and Timer with a clock, wake up: Dim presses and springs back up, the light drops to 40%, the sun’s rays shorten and turn a little and the warm light lowers; Timer stays pressed, its hand makes a full turn and the status rolls to “On · 40% · 30 min”. Pressing power again the ring runs back, the light goes out, Timer pops up and the pill rises back into relief, a pixel past and settling.

How it works

Four shadows in one

Every button has a single box-shadow with four shadows: two outside (relief) and two inset (hollow), all computed from two CSS variables, --o and --i, multiplied into pixels with calc. The script keeps --o and --i in a small object and GSAP animates it, writing the variables on every frame.

Outside first, then inside

An outer shadow can’t morph into an inset one: the press is a two-step timeline, first --o drops to zero with power2.in, then --i grows to the depth with a hair extra and settles. Two veils on the face, domed and concave, swap opacity.

The spring back

On release --i quickly returns to zero and --o climbs back with back.out: the relief goes a pixel past its size and returns, like a real key.

The ring of light

An SVG circle with pathLength 1, rotated −90 degrees so it starts at the top, draws by taking strokeDashoffset from 1 to 0, autoRound off; as it closes its width swells once and returns. With the light off the ring is hidden, or its round cap would stay as a dot.

The rolling status

The status sits in a window one line tall: the new line comes in from below with yPercent and back.out while the old one leaves at the top; the percentage, in tabular-nums digits, counts with a tween on a number.

Values to change

NameFileDefaultWhat it changes
LABELscript.jsLiving room lightThe name of the light written on the button.
LEVELscript.js80The brightness when it turns on, in percent.
DIM_LEVELscript.js40The brightness lowered by the Dim button.
TIMER_MINscript.js30The minutes of the timer that turns the light off.
DEPTHscript.js7How raised the button is: the length of the shadows, in pixels.
PRESS_DEPTHscript.js4How deep the hollow is when pressed, in pixels.
SPRINGscript.js2.2How far the button overshoots as it rises back.
RING_TIMEscript.js0.9How long the ring of light takes to go round, in seconds.
LOOP_PAUSEscript.js1.8The pause with the light off before the loop starts again.

Try them in the Playground

When to use it

In a smart home app or dashboard, on the panel of a lamp, an air purifier or a thermostat, on a soft UI site that wants soft tactile buttons, or as the switch for any feature that turns on and off.

On phones

Under 440 pixels wide the two siblings go under the pill, which takes at most the width minus a margin: everything fits the phone preview box, shadows included. Touch stands in for hover: as soon as the finger lands the key goes halfway down, then on release it reaches the bottom.

With reduced motion

No movement or springs: the light is shown already on at 80% with the ring closed, shadows and colours change with a fade, the status crossfades without rolling, the numbers jump to their value and the self-running loop doesn’t start.

Pitfalls

  • Outer and inset shadows don’t interpolate into each other: GSAP jumped from one to the other. Now all four are always there and only the two lengths are animated.
  • The ring’s round cap with stroke-dashoffset at 1 stayed as an amber dot at the top of the well with the light off: the ring hides once it has retracted.
  • With transform-origin in the CSS the timer hand, rotated by GSAP, spun round the corner of the svg and left the clock: it now uses svgOrigin, like the sun’s rays.
  • Neumorphism needs a background the same colour as the button: on pure white the light shadow disappears, so the background is a light grey and the text is dark to stay readable.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

Tested on 22 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