tabbar

package
v1.23.4 Latest Latest
Warning

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

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

Documentation

Overview

Package tabbar provides a horizontal tab bar for the TUI.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type KeyMap

type KeyMap struct {
	NewTab   key.Binding
	NextTab  key.Binding
	PrevTab  key.Binding
	CloseTab key.Binding
}

KeyMap defines key bindings for the tab bar.

func DefaultKeyMap

func DefaultKeyMap() KeyMap

DefaultKeyMap returns the default tab bar key bindings.

type Tab

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

Tab represents a single rendered tab in the tab bar.

func (Tab) MainZoneEnd

func (t Tab) MainZoneEnd() int

MainZoneEnd returns the X offset where the main click area ends and the close-button click area begins.

func (Tab) View

func (t Tab) View() string

View returns the rendered tab content.

func (Tab) Width

func (t Tab) Width() int

Width returns the total rendered width of the tab.

type TabBar

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

TabBar renders a horizontal bar of session tabs with click and keyboard support.

func New

func New(maxTitleLen int) *TabBar

New creates a new tab bar with the given max title length. If maxTitleLen is <= 0, the default (20) is used.

func (*TabBar) Bindings

func (t *TabBar) Bindings() []key.Binding

Bindings returns consolidated key bindings for the help bar.

func (*TabBar) Height

func (t *TabBar) Height() int

Height returns the height of the tab bar. Returns 0 when there is a single tab (no bar needed).

func (*TabBar) IsDragging

func (t *TabBar) IsDragging() bool

IsDragging returns true when a tab drag is in progress.

func (*TabBar) SetAnimFrame

func (t *TabBar) SetAnimFrame(frame int)

SetAnimFrame updates the animation frame for the running indicator.

func (*TabBar) SetTabs

func (t *TabBar) SetTabs(tabs []messages.TabInfo, activeIdx int)

SetTabs updates the list of tabs and active index.

func (*TabBar) SetWidth

func (t *TabBar) SetWidth(width int)

SetWidth sets the available width for the tab bar.

func (*TabBar) Update

func (t *TabBar) Update(msg tea.Msg) tea.Cmd

Update handles messages and returns commands.

func (*TabBar) View

func (t *TabBar) View() string

View renders the tab bar as a single line: tab tab tab + Returns empty string when there is a single tab.

Jump to

Keyboard shortcuts

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