MCPcopy Index your code
hub / github.com/SorenHolstHansen/leptos_toaster

github.com/SorenHolstHansen/leptos_toaster @v0.1.7

Chat with this repo
repository ↗ · DeepWiki ↗ · release v0.1.7 ↗ · + Follow
38 symbols 51 edges 8 files 5 documented · 13% updated 14mo agov0.1.7 · 2024-05-20★ 374 open issues
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Example

leptos_toaster

A Toaster component for Leptos heavily inspired by sonner

SSR

If using SSR don't forget to set the features in your own Project correctly

[features]
ssr = ["leptos_toaster/ssr"]
hydrate = ["leptos_toaster/hydrate"]

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
    );
}

Core symbols most depended-on inside this repo

Shape

Function 14
Method 14
Class 6
Enum 4

Languages

Rust100%

Modules by API surface

src/types.rs12 symbols
src/toast_id.rs10 symbols
src/toast.rs9 symbols
examples/basic/src/main.rs3 symbols
src/toast_container.rs2 symbols
src/toaster.rs1 symbols
src/mount_style.rs1 symbols

For agents

$ claude mcp add leptos_toaster \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page