Skip to content

EmptyState

A common pattern is to swap between EmptyState variants based on async load status:

// Loading
empty.SetIcon("").SetTitle("Loading...").SetMessage("")
// Loaded but empty
empty.SetIcon(" ").SetTitle("No results").SetMessage("Try a different filter")
// Error
empty.SetIcon(" ").SetTitle("Failed to load").SetMessage(err.Error())
EmptyState preview

EmptyState displays a centered empty/loading/error state.

Constructor func NewEmptyState() *EmptyState

Usage

empty := components.NewEmptyState().
SetIcon("").
SetTitle("No workflows").
SetMessage("Create a workflow to get started")
fmt.Println(empty != nil)

Methods

Method Signature Description
Configure func (e *EmptyState) Configure(icon, title, message string) *EmptyState Configure sets all fields at once.
SetIcon func (e *EmptyState) SetIcon(icon string) *EmptyState SetIcon sets the icon (Nerd Font glyph).
SetMessage func (e *EmptyState) SetMessage(message string) *EmptyState SetMessage sets the secondary message text.
SetTitle func (e *EmptyState) SetTitle(title string) *EmptyState SetTitle sets the main title text.