widgets

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RenderKeybinds

func RenderKeybinds(keybinds []Keybind, theme styles.Theme) string

RenderKeybinds renders a list of keybindings.

func SimpleBox

func SimpleBox(content string, width int) string

SimpleBox renders a simple bordered box without a title.

Types

type Box

type Box struct {
	Title      string
	TitleRight string
	Content    string
	Width      int
	Height     int
	Style      lipgloss.Style
	// contains filtered or unexported fields
}

Box renders a bordered container with an optional title.

func NewBox

func NewBox(title string) Box

NewBox creates a new box with default styling.

func (Box) Render

func (b Box) Render() string

Render returns the styled box as a string.

func (Box) WithContent

func (b Box) WithContent(content string) Box

WithContent sets the box content.

func (Box) WithSize

func (b Box) WithSize(width, height int) Box

WithSize sets the box dimensions.

func (Box) WithStyle

func (b Box) WithStyle(s lipgloss.Style) Box

WithStyle sets a custom style for the box.

func (Box) WithTitleRight

func (b Box) WithTitleRight(text string) Box

WithTitleRight sets the right-aligned title text (e.g., keybindings).

type Footer struct {
	Keybinds []Keybind
	Width    int
	// contains filtered or unexported fields
}

Footer renders a styled keybindings bar.

func NewFooter

func NewFooter(keybinds []Keybind) Footer

NewFooter creates a new footer.

func (Footer) Render

func (f Footer) Render() string

Render returns the styled footer as a string.

func (Footer) WithWidth

func (f Footer) WithWidth(w int) Footer

WithWidth sets the footer width.

type Header struct {
	Title      string
	Status     string
	StatusIcon string
	StatusOk   bool
	Uptime     time.Duration
	Width      int
	Keybinds   []Keybind
	// contains filtered or unexported fields
}

Header renders a styled title bar with status and keybindings.

func NewHeader

func NewHeader(title string) Header

NewHeader creates a new header.

func (Header) Render

func (h Header) Render() string

Render returns the styled header as a string.

func (Header) WithKeybinds

func (h Header) WithKeybinds(kb []Keybind) Header

WithKeybinds sets the keybinding hints.

func (Header) WithStatus

func (h Header) WithStatus(icon, status string, ok bool) Header

WithStatus sets the status text and icon.

func (Header) WithUptime

func (h Header) WithUptime(d time.Duration) Header

WithUptime sets the uptime duration.

func (Header) WithWidth

func (h Header) WithWidth(w int) Header

WithWidth sets the header width.

type Keybind

type Keybind struct {
	Key   string
	Label string
}

Keybind represents a keybinding hint.

type ProgressBar

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

ProgressBar renders a horizontal progress bar with percentage.

func NewProgressBar

func NewProgressBar(percent int) ProgressBar

NewProgressBar creates a new progress bar with the given percentage (0-100).

func (ProgressBar) Render

func (p ProgressBar) Render() string

Render returns the rendered progress bar string.

func (ProgressBar) RenderCompact

func (p ProgressBar) RenderCompact() string

RenderCompact returns a compact progress bar (e.g., for inline display).

func (ProgressBar) WithChars

func (p ProgressBar) WithChars(filled, empty rune) ProgressBar

WithChars sets the characters used for filled and empty portions.

func (ProgressBar) WithShowText

func (p ProgressBar) WithShowText(show bool) ProgressBar

WithShowText controls whether to show the percentage text.

func (ProgressBar) WithStyle

func (p ProgressBar) WithStyle(style lipgloss.Style) ProgressBar

WithStyle sets the style for the filled portion.

func (ProgressBar) WithWidth

func (p ProgressBar) WithWidth(width int) ProgressBar

WithWidth sets the width of the progress bar (not including percentage text).

type Table

type Table struct {
	Columns []TableColumn
	Rows    []TableRow
	Cursor  int
	Width   int
	Height  int
	// contains filtered or unexported fields
}

Table renders a styled table with selection support.

func NewTable

func NewTable(cols []TableColumn) Table

NewTable creates a new table.

func (Table) Render

func (t Table) Render() string

Render returns the styled table as a string.

func (Table) WithCursor

func (t Table) WithCursor(idx int) Table

WithCursor sets the selected row index.

func (Table) WithRows

func (t Table) WithRows(rows []TableRow) Table

WithRows sets the table rows.

func (Table) WithSize

func (t Table) WithSize(width, height int) Table

WithSize sets the table dimensions.

type TableColumn

type TableColumn struct {
	Header string
	Width  int
	Align  lipgloss.Position
}

TableColumn defines a column in the table.

type TableRow

type TableRow struct {
	Icon     string
	Cells    []string
	Selected bool
}

TableRow represents a row in the table.

func ServiceRow

func ServiceRow(icon, name, status, pid, extra string, selected bool) TableRow

ServiceRow is a convenience function for creating service table rows.

Jump to

Keyboard shortcuts

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