toast

package
v1.22.0 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package toast provides a toast notification component for the app.

Index

Constants

View Source
const DefaultTTL = 5 * time.Second

DefaultTTL is how long a toast shows before auto-dismissing.

Variables

This section is empty.

Functions

This section is empty.

Types

type Model

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

Model holds the toast state and renders it. It is a fixed-height component - height is 0 when no toast, 1 when showing.

func New

func New(theme styles.Theme) *Model

New creates a new toast model.

func (*Model) Height

func (m *Model) Height() int

Height returns the number of lines this component renders. Always returns 1 to reserve space and prevent layout shifts.

func (*Model) SetWidth

func (m *Model) SetWidth(width int)

SetWidth sets the available width for rendering.

func (*Model) Update

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

Update handles messages.

func (*Model) View

func (m *Model) View() string

View renders the toast. Returns an empty line if no toast to reserve space.

Jump to

Keyboard shortcuts

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