Comparison
react-iframe-kit covers three jobs that usually take three packages. If you only need one of them and already use a good library for it, you may not need this one.
| react-iframe-kit | react-frame-component | iframe-resizer | Penpal | Comlink | |
|---|---|---|---|---|---|
| Render React into an iframe | ✅ | ✅ | — | — | — |
| Mounts only into the final document | ✅ | ⚠️ ¹ | — | — | — |
| Resize, same-origin | ✅ | — | ✅ | — | — |
| Resize, cross-origin | ✅ | — | ✅ | — | — |
| Method calls | ✅ | — | ⚠️ ² | ✅ | ✅ |
| Events | ✅ | — | ⚠️ ² | — | — |
| Typed calls | ✅ | — | — | ✅ | ✅ |
| React hooks | ✅ | component | ✅ ³ | — | — |
| Host page without React | ✅ ⁶ | — | ✅ | ✅ | ✅ |
| Load and timeout status | ✅ | — | — | ⚠️ ⁷ | — |
| Runtime validation of arguments | ✅ ⁸ | — | — | — | — |
| Origin checks enforced | ✅ | n/a | configurable | configurable | optional ⁴ |
| One connection for everything | ✅ | n/a | n/a | n/a | n/a |
| Built for | iframes | iframes | iframes | iframes, workers, windows | workers ⁵ |
| License | MIT | MIT | GPL-3.0 or commercial (v5+) ⁹ | MIT | Apache-2.0 |
Notes:
- It portals into the iframe’s current document, which may still be the temporary
one, depending on the browser and on whether you pass
initialContent(asrcdoc); see Portal rendering. - Untyped messages between the two sides, not request/response calls.
- Through a separate React package.
- Its window endpoint can be limited to an origin, but nothing makes you.
- Iframes through a window adapter.
react-iframe-kit/host, also as a<script>build (next release).- The connection promise rejects after a timeout; there is no load state for an iframe that doesn’t run the library.
react-iframe-kit/validate, with any Standard Schema library (next release).- Cross-origin use needs a paid license from v5. 4.x and
iframe-resizer-react1.x are MIT but no longer updated.
When to pick something else
Section titled “When to pick something else”- Only RPC to a web worker: Comlink. react-iframe-kit is iframe-only by design.
- Deeply nested objects or callbacks across the boundary: Comlink’s proxies do that.
Here,
remoteis a flat method map and only cloneable data crosses. - You already run iframe-resizer and only need resizing: it’s mature and widely used. The two use different wire protocols and can’t talk to each other. If its license is why you’re looking, see Migrate from iframe-resizer.