custom_html.rs 769 B

12345678910111213141516171819202122232425262728293031323334
  1. //! This example shows how to use a custom index.html and custom <HEAD> extensions
  2. //! to add things like stylesheets, scripts, and third-party JS libraries.
  3. use dioxus::prelude::*;
  4. fn main() {
  5. dioxus::LaunchBuilder::new()
  6. .with_cfg(
  7. dioxus::desktop::Config::new().with_custom_index(
  8. r#"
  9. <!DOCTYPE html>
  10. <html>
  11. <head>
  12. <title>Dioxus app</title>
  13. <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  14. <style>body { background-color: olive; }</style>
  15. </head>
  16. <body>
  17. <h1>External HTML</h1>
  18. <div id="main"></div>
  19. </body>
  20. </html>
  21. "#
  22. .into(),
  23. ),
  24. )
  25. .launch(app);
  26. }
  27. fn app() -> Element {
  28. rsx! {
  29. h1 { "Custom HTML!" }
  30. }
  31. }