tabs

package
v0.0.0-...-e353533 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type KeyMap

type KeyMap struct {
	// Keybindings used when browsing tabs.
	NextPage key.Binding
	PrevPage key.Binding

	// The quit keybinding. This won't be caught when filtering.
	Quit key.Binding
}

KeyMap defines keybindings. It satisfies to the help.KeyMap interface

func DefaultKeyMap

func DefaultKeyMap() KeyMap

DefaultKeyMap returns a default set of keybindings.

func (KeyMap) FullHelp

func (k KeyMap) FullHelp() [][]key.Binding

func (KeyMap) ShortHelp

func (k KeyMap) ShortHelp() []key.Binding

type Model

type Model struct {
	Tabs        []string
	TabContents []subview.Model
	ActiveTab   int

	KeyMap KeyMap
	Help   help.Model
	// contains filtered or unexported fields
}

func New

func New(availableTabs []Tab, opts ...Option) (*Model, error)

New builds a new tab model. Will panic if tab.content is not set to an actual common.Model.

func (*Model) Init

func (m *Model) Init() tea.Cmd

func (*Model) Reset

func (m *Model) Reset()

func (*Model) SetHeight

func (m *Model) SetHeight(height int)

func (*Model) SetWidth

func (m *Model) SetWidth(width int)

func (*Model) Update

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

func (*Model) View

func (m *Model) View() string

type Option

type Option func(options *options) error

func WithColor

func WithColor(color lipgloss.AdaptiveColor) Option

func WithWidth

func WithWidth(width int) Option

type Tab

type Tab struct {
	Name    string
	Content subview.Model
}

Tab each tab is defined by its title and its content

func NewTab

func NewTab(name string, content ...subview.Model) (Tab, error)

Jump to

Keyboard shortcuts

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