InteractionKit

What if a new surface felt like a continuation of the control that opened it?

Try opening and closing the surface. Press Escape to return to its trigger.

Why connect the views?

When a panel appears independently, its relationship to the trigger is implied. Material Design’s earlier motion guidelines describe using motion to show the connection between a new surface and the action that created it1. In the first demo, the button and panel are the same surface: the outline grows, the label stays visible, and the content fades in after the expansion has begun. Closing reverses the size change. Choose “Two buttons” to see a neighboring trigger become an icon while the other surface is open.

From preview to detail

The image changes from a wide crop above the title to a tall crop beside it. The title and description appear in the detail area as the card opens.

A quieter place

Select the card to expand it. Drag the handle down to close, or use the close button or Escape.

From action to editor

A button becomes a place to write, then folds back into a little confirmation.

The note is kept on this page until you reload; it isn’t sent anywhere.

What changes?

The comparison below plays both approaches together. On the left, a separate panel fades in below a stationary trigger. On the right, the trigger’s surface changes size. The connected version makes the origin explicit; the fade keeps the original control visible. Whichever approach you choose, motion is most useful when it communicates a change without distracting from the task2.

Two ways to open

One action, two transitions.

Fade

The surface appears independently.

Connected

The trigger becomes the surface.

Inside the transition

A wireframe of the quick-actions surface as it opens. Play it or drag the timeline to inspect a moment.

Width
144 px
Height
44 px
Content
0%
Speed

The solid outline is the moving surface; dashed outlines show the starting and expanded bounds. Values model an opening from rest using the component’s default spring and content timing. Dragging pauses playback; interrupted transitions can differ.

How the surface grows

Four modeled moments in the opening spring, compared with the original trigger.

0 ms

144 × 44 px

60 ms

194 × 106 px

120 ms

227 × 147 px

200 ms

238 × 160 px

Moving surfaceOriginal trigger

Dimensions are modeled from the demo’s spring, starting from rest, and rounded to the nearest pixel. The dashed outline stays fixed; the surface grows around it. Interrupted transitions can differ.

How the transitions work

The demos animate the same elements between two sets of values; they don’t take snapshots or use the browser View Transitions API. In the quick-actions example:

  • The surface changes from approximately 144 × 44 to 240 × 163 pixels, while its top edge stays in place. Its height comes from the options inside it; the corner radius stays at 14 px.
  • Width and height use the same spring: stiffness: 700, damping: 48, and mass: 0.8. Adjusting these changes how quickly the surface moves and settles.
  • The panel content begins fading in after 60 ms, over 140 ms. On close it fades out over 60 ms as the surface shrinks.
  • The card uses the same spring for its surface and image. The image changes from 100% to 38% of the card’s width. The title crossfades between its two positions instead of flying across the image, and the description begins fading in after 110 ms.
  • The card’s optional dragToClose handle lets you pull down to dismiss. A short pull springs back; a pull beyond 80 px, or a quick downward flick, closes it. The handle remains available to keyboard users as a close button.

These dimensions are choices for the examples, not required values. The image card’s width is also capped by the available space on smaller screens. A different design can change the sizes, spring, or content delay while keeping the same relationship between the two states.

Sizing for your content

The package component fits the closed trigger to its content by default. For the expanded surface, size="sm", size="md", and size="lg" choose widths of 200, 240, and 320 px; md is the default. Each is capped by the available space.

Use closedWidth or openWidth when a design needs a specific size. Height follows the content, then scrolls beyond min(320px, 50vh); --ik-view-transition-max-height changes that limit. The quick-actions example above sets explicit widths so the wireframe can show a consistent measurement.

The package surface follows a non-modal disclosure pattern3, not a complete menu or dialog. The image card, drag handle, and inline note editor are blog experiments, not package exports. See the component API.

From native to web

SwiftUI can connect a zoom transition to a source view4, giving the arriving view a visible point of origin. That relationship is a useful way to think about transitions beyond navigation, too.

This demo uses a physics-based spring5 to animate the surface’s dimensions. Its stiffness, damping, and mass determine how the shape moves and settles. For a closer look at the physics, this spring animation article6 walks through the underlying model. The demo is an exploration, not an implementation of SwiftUI’s transition system.

When reduced motion is enabled7, the demo changes state without the spatial animation.

Footnotes

  1. 1. Material Design, Material motion (earlier, archived guidelines).
  2. 2. Nielsen Norman Group, The role of animation and motion in UX.
  3. 3. W3C ARIA Authoring Practices Guide, Disclosure pattern.
  4. 4. Apple Developer Documentation, Zoom navigation transitions.
  5. 5. Motion, React transitions.
  6. 6. Maxime Heckel, The physics behind spring animations.
  7. 7. MDN Web Docs, prefers-reduced-motion.