Skip to main content

WebView

Function WebView 

Source
pub fn WebView(
    __arg0: &str,
    __arg1: Modifier,
    on_event: impl Fn(WebViewEvent) + 'static,
)
Expand description

Embeds a website inside the component’s layout bounds.

Enable Cranpose’s webview feature for application hosts, or register a WebViewFactory when embedding a component in Android/UIKit. The URL loads only when it changes; unrelated recompositions preserve the document. Desktop uses the system WebView (WebKit, WebView2 or WebKitGTK), Android uses WebView, iOS uses WKWebView, and browsers use an iframe. Browser sites must permit framing. Linux requires WebKitGTK 4.1 and X11 or XWayland.

Native views appear above Cranpose drawing. Use axis-aligned bounds without ancestor transforms or rounded clips, and remove the view before displaying an overlapping Cranpose popup. See crate::native_view::NativeViewLayout.