Skip to main content

Module toast

Module toast 

Source
Expand description

Toast/Notification Components

Toast notifications styled like shadcn/ui Sonner (Toast). Supports multiple positions, variants, and auto-dismiss with progress indicators.

§Example

use armas_basic::components::{ToastManager, ToastVariant};

let mut toasts = ToastManager::new();

// Simple toast
toasts.toast("Changes saved");

// Error toast
toasts.error("Something went wrong");

// Custom toast
toasts.custom()
    .title("Scheduled")
    .message("Your message has been scheduled")
    .duration(std::time::Duration::from_secs(5))
    .show();

// Progress toast (externally driven, won't auto-dismiss)
let id = toasts.custom()
    .title("Exporting")
    .message("Rendering audio...")
    .progress(0.0)
    .show();
// Later: update progress
toasts.set_progress(id, 0.5);
toasts.set_message(id, "Encoding...");
// When done: switch to auto-dismiss countdown
toasts.set_message(id, "Export complete!");
toasts.start_dismiss(id, ctx.input(|i| i.time));

// Render all toasts
toasts.show(ctx);

Structs§

ToastBuilder
Builder for custom toast notifications
ToastId
Opaque handle returned when creating a toast, used to update or dismiss it.
ToastManager
Toast notification manager

Enums§

ToastPosition
Position for toast notifications
ToastVariant
Toast notification variant