Iframe renders an isolated <iframe> and, once it has loaded, mounts a *nested* AppRoot inside the iframe's own contentDocument via a portal. This lets themed Xanui content (its own CSS reset, theme variables, breakpoint context, CSS cache) render correctly inside the iframe's document, while inheriting the parent's active theme by default.
Iframe accepts every prop Tag accepts for an <iframe> element (minus component, which is fixed to "iframe"), plus:
Tag component="iframe" with a blank srcDoc (<!DOCTYPE html><html><head></head><body></body></html>) and default sxr of { border: 'none', width: '100%', height: '100%', p: 0, m: 0 } (overridable via sxr).load event, its contentDocument is captured in state.children are then portaled (via react-dom's createPortal) into the iframe's <body>, wrapped in an IframeContext.Provider (exposing that document/window internally) and a nested AppRoot — rendered with disableRenderar (the iframe reuses the host page's Renderar output rather than mounting its own) and document={iframe.contentDocument} so useDocument()/CSS injection target the iframe's document instead of the host page's.contentDocument is only set after the load event).tsx
import { Iframe, Tag } from 'xanui-core' const PreviewFrame = () => ( <Iframe sxr={{ height: }}> <Tag p={} bgcolor="paper.primary"> Rendered inside the iframe's own document, with its own theme CSS variables. </Tag> </Iframe>)tsx
<Iframe CSSCacheId="preview-frame"> <EditorPreview /></Iframe>tsx
import { Iframe, createTheme } from 'xanui-core' const darkTheme = createTheme({ name: 'dark', mode: 'dark' }) <Iframe theme={darkTheme}> <PreviewContent /></Iframe>