tabbar

package
v1.168.1 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2026 License: Apache-2.0 Imports: 11 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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(ar *animation.Runtime, 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) CanCloseTabWithKey added in v1.168.0

func (t *TabBar) CanCloseTabWithKey() bool

CanCloseTabWithKey reports whether the close shortcut applies.

func (*TabBar) CancelHover added in v1.168.0

func (t *TabBar) CancelHover()

CancelHover immediately resets all hover and click-pulse feedback when the strip loses visibility or focus.

func (*TabBar) ClearHover added in v1.168.0

func (t *TabBar) ClearHover()

ClearHover immediately resets pointer hover fades while letting an in-flight click pulse finish.

func (*TabBar) Height

func (t *TabBar) Height() int

Height returns the number of visible tab rows.

func (*TabBar) IsDragging

func (t *TabBar) IsDragging() bool

IsDragging returns true when a tab drag is in progress.

func (*TabBar) SetCanSpawn added in v1.168.0

func (t *TabBar) SetCanSpawn(canSpawn bool)

SetCanSpawn configures whether new tabs can be spawned (showing "+" and allowing the last remaining tab to be closed and replaced).

func (*TabBar) SetHideSingle added in v1.168.0

func (t *TabBar) SetHideSingle(hide bool)

SetHideSingle controls whether a lone session needs a tab row.

func (*TabBar) SetMaxTitleLength added in v1.109.0

func (t *TabBar) SetMaxTitleLength(maxTitleLen int)

SetMaxTitleLength applies the title truncation limit immediately.

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) TickHover added in v1.168.0

func (t *TabBar) TickHover(tick animation.TickMsg)

TickHover advances button fades on the owner's clock.

func (*TabBar) Update

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

Update handles messages and returns commands.

func (*TabBar) UpdateHover added in v1.168.0

func (t *TabBar) UpdateHover(x int) tea.Cmd

UpdateHover handles tab-local pointer cells; a negative x leaves the strip.

func (*TabBar) View

func (t *TabBar) View() string

View renders the tab bar as a single line: tab tab tab +

func (*TabBar) VisualGeneration added in v1.118.0

func (t *TabBar) VisualGeneration() uint64

VisualGeneration changes only when rendered tab geometry or drag styling changes.

Jump to

Keyboard shortcuts

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