Add postMessage API for embedded Gamma to send resize messages to the parent container
h
h k
Description: When embedding a Gamma (doc or presentation) in an iframe, there’s currently no way for the embedded content to communicate its height back to the parent page. This makes it hard to keep the iframe container tightly sized to the content, especially when the content changes (e.g., expanding sections). A postMessage-based resize API would let the embedded Gamma send a message like { type: "resize", height: 1234 } so the parent can adjust the iframe height dynamically. Today the workaround is making the iframe responsive with percentage-based styling, but that doesn’t solve “tight” sizing.
Nik Payne (Gamma design)
Hey h k, this is a super clear ask, thanks for spelling it out. I’ll pass this along to the team.
Quick couple questions so we design it right:
1) Do you need the resize message to fire only on content changes (expand/collapse, async loads), or also on initial load and window resize?
2) Any constraints on the payload or security model you’d want (ex: fixed message schema, origin allowlist, opt-in query param)?
h
h k
Thanks for looking into this — really appreciate it.
- When should the resize message fire?
All three scenarios would be ideal:
On initial load (so the iframe sizes correctly before any user interaction)
On content changes (expand/collapse, async loads, animations completing)
On window resize (if the content reflows and changes height)
- Payload and security model
Fixed schema — yes please. Something like { type: 'gamma:resize', height: 1240 } would be perfect. A consistent type field lets us filter reliably and avoid false positives from other postMessage traffic on the page.
Origin allowlist — yes, sending only from *.gamma.app so we can validate event.origin on our end and reject spoofed messages.
Opt-in query param — this would be very helpful. Something like ?resizeMessages=true on the embed URL would let us opt in explicitly, which seems sensible if you want to avoid any risk of breaking existing embeds.
Happy to test a prototype if that's useful at any stage.