sidebar

package
v1.3.7 Latest Latest
Warning

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

Go to latest
Published: May 11, 2026 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Overview

Package sidebar is the file-browser sidebar TUI component.

Index

Constants

This section is empty.

Variables

View Source
var (
	ActiveBorderStyle = lipgloss.NewStyle().
						Border(lipgloss.RoundedBorder()).
						BorderForeground(lipgloss.Color("62"))

	InactiveBorderStyle = lipgloss.NewStyle().
						Border(lipgloss.RoundedBorder()).
						BorderForeground(lipgloss.Color("240"))

	SelectedItemStyle = lipgloss.NewStyle().
						Foreground(lipgloss.Color("62")).
						Bold(true)

	RootNodeStyle = lipgloss.NewStyle().
					Foreground(lipgloss.Color("252")).
					Bold(true)

	DirNodeStyle = lipgloss.NewStyle().
					Foreground(lipgloss.Color("252"))

	NormalItemStyle = lipgloss.NewStyle().
					Foreground(lipgloss.Color("252"))
)

Sidebar lipgloss styles, updated by ApplyTheme.

Functions

func ApplyTheme

func ApplyTheme(accent, text, dim lipgloss.Color, selectedBg *string)

ApplyTheme updates sidebar style vars from theme colors.

Types

type Model

type Model struct {
	Height int
	Width  int
	// contains filtered or unexported fields
}

Model is the sidebar component.

func New

func New(cfg *config.Config) Model

New creates a new sidebar model from a config.

func (*Model) FocusPath added in v0.9.0

func (s *Model) FocusPath(path string)

FocusPath expands all ancestor dirs of path, rebuilds, and moves cursor to path.

func (*Model) Refresh added in v0.9.0

func (s *Model) Refresh()

Refresh re-reads directories from disk and rebuilds the visible list.

func (Model) SelectedPath

func (s Model) SelectedPath() string

SelectedPath returns the file path of the highlighted entry, or "" if it's a dir.

func (Model) Update

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

Update handles key messages for sidebar navigation.

func (*Model) UpdateRoots added in v1.2.0

func (s *Model) UpdateRoots(cfg *config.Config)

UpdateRoots rebuilds the roots slice and sort defaults from cfg, preserving the existing expanded state. Called after AddAssetDir or a vault switch.

func (Model) View

func (s Model) View(focused bool) string

View renders the sidebar.

Jump to

Keyboard shortcuts

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