Documentation
¶
Index ¶
- func Back() tea.Msg
- func BackN(n int) tea.Cmd
- func BackToRoot() tea.Msg
- func Notify(message string) tea.Cmd
- func NotifyWithDuration(message string, duration time.Duration) tea.Cmd
- func PushState(state State) tea.Cmd
- func PushTempState(state State) tea.Cmd
- func Redraw() tea.Msg
- func SendError(err error) tea.Cmd
- func Wrap(supplier func() tea.Cmd) tea.Cmd
- type KeyMap
- type Layout
- type Model
- type OnError
- type Option
- func WithDefaultLayout(layout Layout) Option
- func WithKeyMap(keyMap KeyMap) Option
- func WithMinSize(size Size) Option
- func WithOnError(onError OnError) Option
- func WithShowFooter(show bool) Option
- func WithShowHeader(show bool) Option
- func WithSpinner(spinner spinner.Spinner) Option
- func WithStyles(styles Styles) Option
- type Size
- type State
- type Styles
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BackToRoot ¶
BackToRoot traverses to the first (initial) State in the history
func NotifyWithDuration ¶
NotifyWithDuration sends a notification with the given time.Duration ignoring the default
func PushTempState ¶
PushTempState will push a new State that won't be saved into history
Types ¶
type KeyMap ¶
func DefaultKeyMap ¶
func DefaultKeyMap() KeyMap
type Option ¶
type Option func(*Model)
func WithDefaultLayout ¶
func WithKeyMap ¶
func WithMinSize ¶
func WithOnError ¶
func WithShowFooter ¶
func WithShowHeader ¶
func WithSpinner ¶
func WithStyles ¶
type State ¶
type State interface {
// Destroy is called when the state is destroyed
Destroy()
// Focused state will ask Model to ignore its KeyMap.
// For example, pass "?" as tea.KeyMsg to the State instead of handling it by the Model (show help)
Focused() bool
// SetSize sets State's size.
// The given Size is the Size of the terminal minus header and footer
SetSize(size Size) tea.Cmd
// Title of the State
Title() string
// Subtitle is shown below the Title
Subtitle() string
// Layout specifies a custom Layout for the state,
// that will override the default one if the override is set to true
Layout() (layout Layout, override bool)
// Status is shown right to the Title
Status() string
// KeyMap of the State
KeyMap() help.KeyMap
// Init is the first function that will be called. It returns an optional
// initial command. To not perform an initial command return nil.
// This function is also called when the State is being popped out from the history
Init(ctx context.Context) tea.Cmd
// Update is called when a message is received. Use it to inspect messages
// and, in response, update the model and/or send a command.
Update(ctx context.Context, msg tea.Msg) tea.Cmd
// View renders the State's UI, which is just a string. The view is
// rendered after every Update.
View(layout Layout) string
}
type Styles ¶
type Styles struct {
Global,
Title,
Header,
Subtitle,
Status,
Spinner,
Notification,
}
func DefaultStyles ¶
func DefaultStyles() Styles
Source Files
¶
Click to show internal directories.
Click to hide internal directories.