Primitives

Toast

Notification toast component for ephemeral messages.

Overview

The Toast primitive displays temporary notifications that automatically dismiss after a timeout.

Basic Usage

use ratkit::primitives::toast::{Toast, ToastType};

fn show_notification() {
    let toast = Toast::new("Operation completed!")
        .toast_type(ToastType::Success)
        .duration(Duration::from_secs(3));
    
    toast.show();
}

Toast Types

Available toast types:

  • Info - General information
  • Success - Successful operations
  • Warning - Warning messages
  • Error - Error notifications

Customization

let toast = Toast::new("Saved successfully")
    .toast_type(ToastType::Success)
    .position(ToastPosition::BottomRight)
    .duration(Duration::from_secs(5));