tabs

package
v0.0.0-...-0fd1ed7 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2022 License: MIT Imports: 6 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

	// The quit-no-matter-what keybinding. This will be caught when filtering.
	ForceQuit 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 name of each tab
	Tabs []string
	//TabContents components inside each tab
	TabContents []tea.Model
	//ActiveTab index of the active tab
	ActiveTab int

	//KeyMap Key mappings for navigating the list.
	KeyMap KeyMap
	Help   help.Model
	// contains filtered or unexported fields
}

func New

func New(availableTabs []Tab, color lipgloss.AdaptiveColor, width int) Model

New builds a new tab model

func (Model) Init

func (m Model) Init() tea.Cmd

func (Model) Update

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

func (Model) View

func (m Model) View() string

type Tab

type Tab struct {
	Name    string
	Content tea.Model
}

Tab each tab is defined by its title and its content

Jump to

Keyboard shortcuts

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