Skip to content
animorio
IT
All components

Notifications prompt

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

The card a flight app uses to ask for notification permission, on white, in the style of real product interface pieces: at the top two sample alerts drop in one after the other on a spring and stack, below three switches choose which alerts to get. Allow swings the bell, the alerts fly into it and «You’re all set» appears with a check drawing 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>
<!--
  "Notifications prompt" 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 notifications prompt with a preview sliding down</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>
    <!-- the notifications permission card of a flight app: two sample alerts drop in and stack,
         three small switches choose which alerts, Allow swings the bell and gathers the alerts into it -->
    <section class="ask" data-card aria-label="Kestrow notifications">
      <div class="preview" data-preview aria-hidden="true">
        <div class="preview__time">9:41</div>
        <article class="note" data-note>
          <span class="note__icon"><svg viewBox="0 0 24 24"><path d="M3.5 13.2 9 12l3.4-6.3c.4-.8 1.6-.6 1.6.3l-.2 5.2 5.2-1.1c1.1-.2 1.9.9 1.3 1.8l-.5.7-5.8 1.4-.3 5.4c0 .8-1 1.1-1.5.5l-2.3-4.2-4.9 1.2c-.9.2-1.5-.9-.9-1.6Z"/></svg></span>
          <div class="note__body">
            <p class="note__top"><b>Kestrow</b><span>now</span></p>
            <p class="note__title">Gate changed to B12</p>
            <p class="note__text">KS 204 to Lisbon now boards at 14:40.</p>
          </div>
        </article>
        <article class="note" data-note>
          <span class="note__icon"><svg viewBox="0 0 24 24"><path d="M3.5 13.2 9 12l3.4-6.3c.4-.8 1.6-.6 1.6.3l-.2 5.2 5.2-1.1c1.1-.2 1.9.9 1.3 1.8l-.5.7-5.8 1.4-.3 5.4c0 .8-1 1.1-1.5.5l-2.3-4.2-4.9 1.2c-.9.2-1.5-.9-.9-1.6Z"/></svg></span>
          <div class="note__body">
            <p class="note__top"><b>Kestrow</b><span>now</span></p>
            <p class="note__title">Boarding in 20 minutes</p>
            <p class="note__text">Head to gate B12, seat 14A is waiting.</p>
          </div>
        </article>
      </div>

      <div class="lower" data-lower>
        <div class="form" data-form>
          <header class="head">
            <span class="bell" data-bell>
              <svg viewBox="0 0 24 24" aria-hidden="true"><g data-bell-swing><path d="M6.2 16.2V11a5.8 5.8 0 0 1 11.6 0v5.2l1.4 1.8H4.8Z"/><path class="bell__clap" data-clapper d="M10 20.2a2.1 2.1 0 0 0 4 0"/></g></svg>
            </span>
            <div>
              <h1 class="head__title">Turn on notifications</h1>
              <p class="head__sub">Get gate changes and boarding times the moment they happen.</p>
            </div>
          </header>

          <ul class="opts">
            <li><span>Gate changes</span><button class="switch is-on" data-switch role="switch" aria-checked="true" aria-label="Gate changes"><i></i></button></li>
            <li><span>Boarding times</span><button class="switch is-on" data-switch role="switch" aria-checked="true" aria-label="Boarding times"><i></i></button></li>
            <li><span>Price drops</span><button class="switch" data-switch role="switch" aria-checked="false" aria-label="Price drops"><i></i></button></li>
          </ul>

          <div class="acts">
            <button class="btn btn--ghost" data-later>Not now</button>
            <button class="btn btn--solid" data-allow><span data-allow-label>Allow</span></button>
          </div>
        </div>

        <div class="done" data-done aria-live="polite">
          <svg class="done__check" viewBox="0 0 40 40" aria-hidden="true"><circle cx="20" cy="20" r="17" data-ring></circle><path d="m12.5 20.6 5 5 10-11" data-tick></path></svg>
          <p class="done__title" data-done-title>You’re all set</p>
          <p class="done__sub" data-done-sub>We’ll only send the 2 alerts you chose.</p>
        </div>
      </div>
    </section>
    <svg class="ghost" data-ghost viewBox="0 0 24 24" aria-hidden="true"><path d="M5 3.2 19.2 11l-6.3 1.6-3.3 5.9Z"></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.

31 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 “Notifications prompt” 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 very light grey background sits the white card of Kestrow, an invented flight app, asking for notification permission. At the top a small lock screen, pale blue and peach with the time 9:41: the first sample alert, «Gate changed to B12», drops from the top on a spring, lands and squashes slightly; soon after the second arrives, «Boarding in 20 minutes», landing on top of it and pushing it back, smaller and dimmer. Below, the bell in a light blue square, the title «Turn on notifications», a line explaining it and three switches to choose which alerts: Gate changes and Boarding times on, Price drops off. Tapping a switch slides its knob on a spring, stretching it for a moment along the way. At the bottom Not now and the black Allow button. Pressing Allow swings the bell with its clapper, the two alerts fly one after the other into the bell, shrinking, and it gives a small jolt at each arrival; then the form goes and in its place comes «You’re all set», with the circle and the check drawing themselves and the line counting the alerts chosen. Not now sends the alerts back up and says how to turn them on later. A drawn pointer does it all by itself and starts again; it also really works, with mouse, touch and keyboard.

How it works

Two alerts in the same place

The sample alerts are absolute and in the same spot: the first drops with yPercent from -130 to 0 and back.out, squashes to 97% of its height and comes back with elastic; when the second arrives, sitting above it in the DOM, the first moves down a few pixels, shrinks to 0.94 and dims, so it reads as a stack.

A knob that stretches

The switch moves its knob 14 pixels with back.out while widening it by 28% towards where it is going, with the origin on the right side; then it brings it back to 1 with elastic. The track colour changes with a CSS transition.

Alerts going into the bell

On Allow the script measures the centre of the bell and of each alert, and sends them there with relative x and y, shrinking them to 6% and turning them a little. At each arrival the bell jolts to 1.14 and comes back with elastic, while the bell group swings from a pivot at the top and the clapper rocks on its own.

The check and the count

The circle and the check are paths with a strokeDasharray as long as themselves: they draw one after the other. The line below counts the switches that are on at that moment, so it says how many alerts will really come.

The autopilot

A timeline with repeatRefresh drops the alerts, takes the drawn pointer to Price drops reading its position every time, turns it on and presses Allow. At the first real touch it stops, and it starts again after eight quiet seconds.

Values to change

NameFileDefaultWhat it changes
APPscript.jsKestrowThe name of the app asking for permission, written on the sample alerts.
ACCENTscript.js#2f6bffThe colour of the icon, the switches that are on and the check.
DROPscript.js0.75The seconds a sample alert takes to drop and land on its spring.
STACK_GAPscript.js12How many pixels the first alert moves down when the other lands on top of it.
SWINGscript.js16How many degrees the bell swings when Allow is pressed.
HOLDscript.js2.4The seconds «You’re all set» stays before the autopilot starts again.

Try them in the Playground

When to use it

For an app’s onboarding, the permission ask before the system one, the notification settings of a dashboard, a travel, delivery or booking app that wants to alert at the right moment.

On phones

The card takes the full width minus the margins, the lock screen and the switch rows shorten with the window height, measured in vh, so everything fits in the box; the buttons stay at least 36 pixels tall for a finger. A tap does what a click does.

With reduced motion

No drops, swings or flights: the alerts appear already stacked with a fade, the switches change without a spring, and Allow fades the alerts out and shows «You’re all set» with the check already drawn. The drawn pointer stays hidden.

Pitfalls

  • The alerts fly into the bell with relative x and y («+=»), measured at that moment, because the first has already been moved and shrunk by the stack and the demo window may have changed size.
  • The bell swings from a pivot at the top (transformOrigin 50% 12%) and the clapper is a separate path rocking sideways: all in one piece it looked like a rubber bell.
  • If Allow is pressed while the alerts are still dropping, their timeline jumps to the end before they fly, otherwise the centre measurement is wrong.

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 27 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