| Crates.io | yew-toastify |
| lib.rs | yew-toastify |
| version | 0.1.0 |
| created_at | 2026-01-25 00:37:24.468625+00 |
| updated_at | 2026-01-25 00:37:24.468625+00 |
| description | Toast components library for Yew with Tailwind CSS support |
| homepage | https://github.com/Black-Cockpit/yew-toastify |
| repository | https://github.com/Black-Cockpit/yew-toastify |
| max_upload_size | |
| id | 2067781 |
| size | 92,866 |
Toast/notification components library for Yew. Like react-toastify but for Yew with flexible CSS framework support.
# Cargo.toml
# With standard toast components (recommended)
yew-toastify = { version = "0.3", features = ["standard-notification"] }
# For custom toast implementations only
yew-toastify = "0.3"
use yew_toastify::{
use_notification, Notification, NotificationFactory, NotificationType,
NotificationsPosition, NotificationsProvider, NotificationStyle,
};
// 1. Wrap your app with NotificationsProvider
#[function_component(App)]
fn app() -> Html {
let component_creator = NotificationFactory;
html! {
<NotificationsProvider<Notification, NotificationFactory>
{component_creator}
position={NotificationsPosition::BottomRight}
style={NotificationStyle::default()}
>
<MyApp />
</NotificationsProvider<Notification, NotificationFactory>>
}
}
// 2. Spawn toasts from any component
#[function_component(MyApp)]
fn my_app() -> Html {
let toasts = use_notification::<Notification>();
let on_click = {
let toasts = toasts.clone();
Callback::from(move |_| {
toasts.spawn(Notification::new(
NotificationType::Success,
"Success!",
"Operation completed.",
Duration::seconds(5),
));
})
};
html! { <button onclick={on_click}>{"Show Toast"}</button> }
}
NotificationStyle lets you customize all CSS classes. Here's how to use Bulma:
let bulma_style = NotificationStyle::default()
.with_container("notification")
.with_info("is-info")
.with_warn("is-warning")
.with_error("is-danger")
.with_success("is-success")
.with_title("title")
.with_text("subtitle");
NotificationsPosition::TopLeft
NotificationsPosition::TopCenter
NotificationsPosition::TopRight
NotificationsPosition::BottomLeft
NotificationsPosition::BottomCenter
NotificationsPosition::BottomRight
NotificationsPosition::Custom("your-custom-classes".into())
See the examples directory for working code examples:
For detailed descriptions and run instructions, see the Examples README.
Distributed under the MIT license.