Skip to content
animorio
IT
All components

Block user button

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

The button that blocks a person from their profile row, on black: on tap a red ring closes around the avatar and a slash crosses it, the face loses its colour, the name dims and the button becomes “Unblock”. Another tap and slash and ring withdraw, the face comes back with a bounce.

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>
<!--
  "Block user 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>Block user 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 button that blocks a person from their profile row: a ring and a slash draw themselves over the avatar,
         the name dims and the button turns into Unblock -->
    <div class="bu" data-bu>
      <span class="bu__face" aria-hidden="true">
        <span class="bu__pic" data-pic>TR</span>
        <svg viewBox="0 0 44 44"><circle data-ring cx="22" cy="22" r="20" pathLength="1" transform="rotate(-45 22 22)"></circle><path data-slash pathLength="1" d="M7.900 7.900l28.200 28.200"></path></svg>
      </span>
      <span class="bu__who">
        <b data-name>Theo Rask</b>
        <span class="bu__sub"><span data-sub>@theo.rask</span></span>
      </span>
      <button class="bu__btn" type="button" aria-pressed="false" data-btn><span class="bu__label"><span data-label>Block</span></span></button>
      <span class="bu__say" data-say aria-live="polite"></span>
    </div>

    <svg class="ghost" data-ghost viewBox="0 0 24 24" aria-hidden="true"><path d="M5 3.200 19.200 11l-6.300 1.600-3.300 5.900Z"></path></svg>
  </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

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 “Block user 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 black, a dark pill: on the left a round avatar with initials over a gradient from yellow to purple, then the name “Theo Rask” and under it “@theo.rask”; on the right a small soft red button, “Block”. On tap the button gives on a spring, around the avatar a red ring closes starting from the top left, then a slash crosses it diagonally; the avatar shrinks slightly, turns grey and dims, the name loses strength, the line below rolls into “Blocked quietly” and the button goes dark reading “Unblock”. Tap it again and the slash withdraws, the ring reopens, the avatar comes back in colour with a bounce and everything is as it was.

How it works

Ring and slash

They are an SVG circle and line with pathLength 1: the dashoffset goes from 1 to 0, the ring first and then the slash; the circle is rotated in the transform attribute so it starts at the top left.

The face

A class on the pill greys and dims it with a transition; GSAP only gives it the slight shrink and the bounce on the way back.

The words

The button and the line below roll out and come back with the new text; aria-pressed tells the state.

Going back

The same button unblocks: the slash withdraws first, then the ring, the reverse of the way in.

Values to change

NameFileDefaultWhat it changes
ACCENTscript.js#ff5c50The colour of the Block button, of the ring and of the slash.
NAMEscript.jsTheo RaskThe person’s name: the initials and the handle come from it.
DRAWscript.js0.5In how many seconds the ring and the slash draw themselves.
SPRINGscript.js1How much the button and the avatar bounce: 0.3 = a little, 2 = a lot.
LOOPscript.jstrueLeft alone, the demo’s pointer blocks the person and then unblocks them.

Try them in the Playground

When to use it

In apps where people write to, follow or comment on each other: social, chat, forums, games, marketplaces. In the followers list, on the profile, in the privacy settings, next to anyone who can be blocked.

On phones

The same pill, 300 pixels wide at most and 68 tall: the button is 36 pixels tall, a long name is cut and the line below stays on one line.

With reduced motion

Ring and slash appear already drawn, the words change without rolling and the avatar changes colour with its transition. The demo does not move by itself.

Pitfalls

  • The person is made up and nothing is blocked: in a real app the block goes to the server and the state changes when it answers.
  • Blocking is reversible, so there is no confirmation dialog here: the same button goes back. Actions that cannot be undone need the confirmation.
  • The state is not told by red alone: the button’s label, the line below and aria-pressed all change.
  • The ring’s SVG stays hidden until needed: with round caps a stroke at full dashoffset would leave a dot on the avatar.
  • The handle is derived from the name written in NAME: in a real app it comes from the person’s data.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

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