lotusui the ikaito design language for Gio — desktop, mobile, web
GitHub

Toast

Transient notifications: bottom-right stack, auto-dismissing.

Toaster owns the queue: Add from anywhere, Layout ONCE per frame at window constraints (the same portal rule as Dialog). Each toast dismisses after its duration; destructive toasts carry danger ink.

Installation

Use the module import (the default), or own the source: lotusui add vendors the component into your app and lotusui update keeps the copy mergeable — see Registry.

Go
go get github.com/ikaito-com/lotusui

# or vendor the source into your app:
go run github.com/ikaito-com/lotusui/cmd/lotusui add toast

Usage

Go
var toaster lotusui.Toaster // one per window

if saved { toaster.Add(lotusui.Toast{Title: "Event has been created"}) }

// at the END of your window's frame:
toaster.Layout(th, gtx)

Types

Success, info and warning color the title's ink; destructive colors everything.

Go
toaster.Add(lotusui.Toast{Variant: lotusui.ToastSuccess, Title: "Event has been created"})
toaster.Add(lotusui.Toast{Variant: lotusui.ToastInfo, Title: "Arrive 10 minutes before the event"})

Promise

The in-flight pattern: Add a Loading toast under an ID, then Update the same ID with the outcome — it replaces in place and restarts the clock.

Go
toaster.Add(lotusui.Toast{ID: "create", Loading: true, Title: "Creating event…", Duration: time.Minute})
// …when the work completes:
toaster.Update("create", lotusui.Toast{Variant: lotusui.ToastSuccess, Title: "Event created."})

API

OptionTypeDescription
Toaster.Add(Toast)methodEnqueue from anywhere; safe during event handling.
Toaster.Update(id, Toast)methodReplace the live toast with that ID in place — the promise pattern.
Toast.Title / DescriptionstringThe notification's copy.
Toast.VariantToastVariantToastDefault, ToastDestructive, ToastSuccess, ToastInfo, ToastWarning.
Toast.IDstringNames the toast for Update.
Toast.LoadingboolA spinner before the title.
Toast.Durationtime.DurationAuto-dismiss delay; zero means 4s.

Every demo on this site is the real Go component compiled to WebAssembly — one gallery app, one bundle, addressed by URL hash.