title.rs 635 B

123456789101112131415161718192021
  1. //! This example shows how to set the title of the page or window with the Title component
  2. use dioxus::prelude::*;
  3. fn main() {
  4. dioxus::launch(app);
  5. }
  6. fn app() -> Element {
  7. let mut count = use_signal(|| 0);
  8. rsx! {
  9. div {
  10. // You can set the title of the page with the Title component
  11. // In web applications, this sets the title in the head. On desktop, it sets the window title
  12. document::Title { "My Application (Count {count})" }
  13. button { onclick: move |_| count += 1, "Up high!" }
  14. button { onclick: move |_| count -= 1, "Down low!" }
  15. }
  16. }
  17. }