components

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package components holds reusable, self-contained UI widgets.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsClick

func IsClick(msg tea.MouseMsg) bool

IsClick reports whether a mouse event is a left-button press.

func IsMotion

func IsMotion(msg tea.MouseMsg) bool

IsMotion reports whether a mouse event is movement, used to drive hover.

func Row

func Row(buttons ...Button) string

Row lays buttons out horizontally with a single-space gutter.

Types

type Button

type Button struct {
	ID    string
	Label string
	// Key is an optional keyboard shortcut shown inside the button, keeping the
	// mouse an accelerator rather than the only way in.
	Key      string
	Variant  Variant
	Disabled bool
	Hovered  bool
	MinWidth int
}

Button is a clickable control. Rendering registers a mouse zone under ID, so Hit can test a later mouse event against the region actually drawn.

func (Button) Hit

func (b Button) Hit(msg tea.MouseMsg) bool

Hit reports whether the event is a left click inside this button.

func (Button) Hovering

func (b Button) Hovering(msg tea.MouseMsg) bool

Hovering reports whether the event falls inside this button's drawn region.

func (Button) View

func (b Button) View() string

View renders the button and registers its mouse zone.

type Variant

type Variant int

Variant selects a button's color treatment.

const (
	VariantPrimary Variant = iota
	VariantSecondary
	VariantDanger
	VariantGhost
)

Jump to

Keyboard shortcuts

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