Skip to main content

dioxus_three/
desktop.rs

1//! Desktop implementation of ThreeView using WebView iframe
2
3use crate::{generate_three_js_html, ThreeViewProps};
4use dioxus::prelude::*;
5
6/// A Three.js 3D viewer component for Dioxus Desktop
7///
8/// Uses a WebView iframe to render the Three.js scene.
9/// Supports all features including multiple models, shaders, and animations.
10#[component]
11pub fn ThreeView(props: ThreeViewProps) -> Element {
12    let html = generate_three_js_html(&props);
13
14    rsx! {
15        iframe {
16            class: "{props.class}",
17            style: "width: 100%; height: 100%; border: none;",
18            srcdoc: "{html}",
19        }
20    }
21}