04.07 · Micro-Interactions

Heart / Like Burst

The heart pops and fills as small hearts burst out. Best for like buttons.

Click it

Click or tap the heart to like it and again to unlike it, or press Show me.

Likes 128

Try it

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

Number of hearts

More pieces make a bigger celebration.

How far they fly

How far the pieces travel before they fade.

Copy the prompt

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

Add a like button with a burst to [the heart or favorite button you want to reward]. When the visitor likes something, the heart quickly squashes, overshoots a little and settles as it fills with color, while a spray of tiny hearts and dots flies out from its center, arcs down and fades. Unliking simply removes the color, with no burst. Draw the burst on one layer over the button and stop drawing once the last piece has faded. Tell screen readers whether it is liked. If the visitor has reduced motion turned on, only fill the heart, with no pop or burst. 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

  • Like buttons
  • Favorites
  • Bookmarks
  • Reactions

Avoid on

  • Delete buttons
  • Neutral toggles