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.
Inside, the small box is where the window starts, at the button you pressed; every corner grows out along its line to the full window. Press any button, or Show me.
From the middle: the window ignores which button you pressed; From the button: it grows out of the one you pressed and shrinks back into it. Press any button, or 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.
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.
Your settings
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 GitHubWhat it is
The full explanation is in README.md.