templUI Pro coming soon  

50% OFF Join Waitlist

Toast

Flexible toast component for notifications and feedback.

TailwindCSS
Vanilla JS

Installation

templui add toast
// Template
templ UserForm() {
	<form hx-post="/save" hx-target="#toast">
	   <input name="email" />
	</form>
	<div id="toast"></div>
}
// Handler
func Save(w http.ResponseWriter, r *http.Request) {
	if err != nil {
		components.Toast(components.ToastProps{
			Text: err.Error(),
			Variant: components.ToastVariantError,
		}).Render(r.Context(), w)
	}
}

Examples

Playground