title.rs 654 B

12345678910111213141516171819202122
  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. tracing_subscriber::fmt::init();
  5. launch(app);
  6. }
  7. fn app() -> Element {
  8. let mut count = use_signal(|| 0);
  9. rsx! {
  10. div {
  11. // You can set the title of the page with the Title component
  12. // In web applications, this sets the title in the head. On desktop, it sets the window title
  13. Title { "My Application (Count {count})" }
  14. button { onclick: move |_| count += 1, "Up high!" }
  15. button { onclick: move |_| count -= 1, "Down low!" }
  16. }
  17. }
  18. }