04.18 · Micro-Interactions

Modal Expand

A window grows out of the button you pressed. Best for detail views.

Click it

Press any of the five buttons and watch the window grow out of it, or press Show me.

Try it

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

Speed

How long the window takes to grow to full size.

Starting size

How small it is as it leaves the button.

Feel

Springy goes a little past full size, then settles.

More optionsFewer options

A dot shows the point the window grows out of.

Copy the prompt

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

Add a modal that grows out of its button to [the button or card that opens a dialog or detail view]. When it is pressed, measure where that button sits and grow the modal from that spot to full size in the middle of the screen while the page behind it dims, so it clearly comes from what was pressed. Close it with its buttons, a tap on the dimmed page or the Escape key, and let it shrink back toward the same spot. Animate only its scale and opacity. Move keyboard focus into it, and back to the button when it closes. If the visitor has reduced motion turned on, show it at full size without growing. 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

  • Detail views
  • Confirmations
  • Quick forms
  • Action buttons

Avoid on

  • Long content
  • Full pages