Motion guide · 4 of 8
Overlays
Overlays such as Dialog, Drawer, BottomSheet, Popover and Menu open and close with the motion system. They can grow out of the element that opened them, move the page with them, and change what's inside.
Grow from the trigger
morph: 'trigger' grows the panel out of the element that opened it, and shrinks it back into that element on close.
Grow from any element
Give morph an object whose from returns an element, such as the row you clicked: morph: { from: () => row, hide: false }. hide: false keeps the row on screen while the dialog is open.
A gooey popover
surface draws a layer of shapes behind a Popover: a pill on its trigger and a blob that moves with the panel, both in the panel's color. Give the layer one of your style's filters, such as a goo, and the shapes melt into each other while the text stays sharp.
<Popover
open-on-trigger-click
:motion="{ morph: 'trigger', surface: { filter: 'url(#goo)' } }"
>Move the page with it
linked moves other elements while a Dialog, Drawer or BottomSheet is open, such as a page that recedes behind a drawer. Each entry names an element and how it looks while the overlay is open.
The parts inside
initial also animates a dialog's title, body and footer, so they can follow the panel in. exitOrder: 'reverse' closes them before the panel. stagger brings them in one after another, in page order: stagger: true.
Change what's inside
Put one keyed element in the dialog and change its key. swap: 'wait' lets the old element leave before the new one arrives, and direction tells your values which way you moved. As the new content comes in, the panel eases to its size; resize: false snaps to it.
Ask before closing
before-close decides whether the dialog closes. Return true to close, false to stay open, or a promise of either, such as a confirm. The dialog stays still until the answer arrives.