mirror of
https://github.com/adoyle0/thaw.git
synced 2025-01-23 22:39:23 -05:00
3684f5961b
* demo: refactor docs * demo: refactor docs * demo: refactor guide docs * chore: workflow add listens to the demo_markdown * demo: refactor mobile docs
33 lines
865 B
Markdown
33 lines
865 B
Markdown
# Toast
|
|
|
|
```rust
|
|
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. |
|