thaw/demo_markdown/docs/_mobile/toast/mod.md
luoxiaozero 3684f5961b
demo: refactor docs (#67)
* demo: refactor docs

* demo: refactor docs

* demo: refactor guide docs

* chore: workflow add listens to the demo_markdown

* demo: refactor mobile docs
2024-01-03 20:52:56 +08:00

865 B

Toast

use thaw::mobile::*;
use std::time::Duration;

let count = create_rw_signal(0u32);
let onclick = move |_| {
    show_toast(ToastOptions {
        message: format!("Hello {}", count.get_untracked()),
        duration: Duration::from_millis(2000),
    });
    count.set(count.get_untracked() + 1);
};
view! {
    <div style="margin: 20px">
        <Button on_click=onclick>"hi"</Button>
    </div>
}

Toast Methods

Name Type Description
show_toast Fn(options: ToastOptions)) Show toast.

ToastOptions Properties

Name Type Description
message String message.
duration std::time::Duration Show duration.