04.41 · Micro-Interactions

Dynamic Island

A black pill grows into a notification, then shrinks back. Best for live updates.

Click it

Click or tap the black pill to open it and again to close it, or press Show me.

Try it

Change a setting, then try it again or press Show me.

Notification

What the pill grows into; pick another while it is open to see it change shape.

Speed

How quickly it grows and shrinks.

Bounce

How far it grows past its size before it settles.

Copy the prompt

Paste it into an AI assistant such as ChatGPT, Claude or Cursor to build this in your own project.

Add a Dynamic Island style notification to [the top of your app or page]. At rest it is a small black pill; when [an event such as an incoming message] happens or the pill is pressed, it grows into a rounded card with the details, then shrinks back. Change the black shape with a clip or a scale, never by animating its width or height, so the text inside never stretches and nothing around it moves. Keep the details inside the shape, fading them in once it has room. Make the pill a real button for taps, clicks and the keyboard, and announce its message politely to screen readers. If the visitor has reduced motion turned on, crossfade the pill and the card instead. Match the settings listed below.

Replace the words in brackets with your own element. Your settings are added at the end.

Free and open source. If this helped, a star on GitHub helps other people find it.

Star on GitHub

What it is

The full explanation is in README.md.

Good for

  • Calls and timers
  • Music players
  • Order tracking
  • Live scores

Avoid on

  • Long messages
  • Errors that need action