4 releases

0.1.3 Mar 9, 2024
0.1.2 Feb 6, 2024
0.1.1 Feb 6, 2024
0.1.0 Feb 6, 2024

#1539 in Web programming

Download history 3/week @ 2024-02-03 16/week @ 2024-02-17 38/week @ 2024-02-24 8/week @ 2024-03-02 209/week @ 2024-03-09 59/week @ 2024-03-16 4/week @ 2024-03-23 22/week @ 2024-03-30 4/week @ 2024-04-06 68/week @ 2024-04-13

100 downloads per month

MIT license

525KB
665 lines

Example

leptos_toaster

A Toaster component for Leptos heavily inspired by sonner

Usage

Somewhere, probably near the top of your component tree, add the Toaster component

view! {
	<Toaster
	    position=toaster::ToasterPosition::BottomCenter
	>
		// ...
	</Toaster>
}

and then whenever you need a toast, do

let toast_context = expect_context::<Toasts>();

let create_toast = move || {
	let toast_id = ToastId::new();
	toast_context.toast(
		// This uses the built in toast component that requires the `builtin_toast` feature.
		// You can use your own components here
		view! { 
			<Toast 
				toast_id 
				variant=ToastVariant::Info 
				title=view! {"My toast"}.into_view() 
			/> 
		},
		Some(toast_id),
		None // options
	);
}

Dependencies

~19–33MB
~523K SLoC