toast

package
v0.267.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 3, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package toast renders transient bottom-right status chips that auto-expire. Multiple toasts stack; errors linger longer; long text wraps rather than being truncated.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Level

type Level int

Level selects the toast's icon and color.

const (
	Info Level = iota
	Success
	Error
)

type Model

type Model struct {
	// contains filtered or unexported fields
}

Model holds a stack of active toasts (newest at the bottom).

func New

func New() Model

New returns an empty toast model.

func (Model) Active

func (m Model) Active() bool

Active reports whether any toast is showing.

func (Model) Levels

func (m Model) Levels() []Level

Levels returns the level of each toast currently showing, oldest first.

func (*Model) Push

func (m *Model) Push(l Level, text string) tea.Cmd

Push adds a toast and returns the command that expires it. Errors dwell longer than info/success so a failure can be read, but every toast eventually auto-expires so none linger on screen indefinitely. When the stack is full the oldest toast drops off.

func (*Model) Update

func (m *Model) Update(msg tea.Msg) tea.Cmd

Update removes a toast when its own timer fires (stale timers no-op).

func (Model) View

func (m Model) View() string

View renders the stack of chips, or "" when empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL