Documentation
¶
Index ¶
- Variables
- type BarChart
- type Button
- type Calendar
- type Checkbox
- type DrawDirection
- type EchoMode
- type Flex
- type FlexDirection
- type FunnelChart
- type Gauge
- type Heatmap
- type Image
- type Input
- type LineGauge
- type List
- func (l *List) Draw(buf *ui.Buffer)
- func (l *List) ScrollAmount(amount int)
- func (l *List) ScrollBottom()
- func (l *List) ScrollDown()
- func (l *List) ScrollHalfPageDown()
- func (l *List) ScrollHalfPageUp()
- func (l *List) ScrollPageDown()
- func (l *List) ScrollPageUp()
- func (l *List) ScrollTop()
- func (l *List) ScrollUp()
- type Logo
- type Modal
- type Paragraph
- type PieChart
- type PieChartLabel
- type Plot
- type PlotMarker
- type PlotType
- type RadarChart
- type Scrollbar
- type ScrollbarOrientation
- type Sparkline
- type SparklineGroup
- type Spinner
- type StackedBarChart
- type StepChart
- type TabPane
- type Table
- type TextArea
- type Tree
- func (t *Tree) Collapse()
- func (t *Tree) CollapseAll()
- func (t *Tree) Draw(buf *ui.Buffer)
- func (t *Tree) Expand()
- func (t *Tree) ExpandAll()
- func (t *Tree) ScrollAmount(amount int)
- func (t *Tree) ScrollBottom()
- func (t *Tree) ScrollDown()
- func (t *Tree) ScrollHalfPageDown()
- func (t *Tree) ScrollHalfPageUp()
- func (t *Tree) ScrollPageDown()
- func (t *Tree) ScrollPageUp()
- func (t *Tree) ScrollTop()
- func (t *Tree) ScrollUp()
- func (t *Tree) SelectedNode() *TreeNode
- func (t *Tree) SetNodes(nodes []*TreeNode)
- func (t *Tree) ToggleExpand()
- func (t *Tree) Walk(fn TreeWalkFn)
- type TreeMap
- type TreeMapNode
- type TreeNode
- type TreeWalkFn
Constants ¶
This section is empty.
Variables ¶
var ( SpinnerLine = []string{"|", "/", "-", "\\"} SpinnerDots = []string{"⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"} SpinnerMiniDots = []string{"⠋", "⠙", "⠚", "⠞", "⠖", "⠦", "⠴", "⠲", "⠳", "⠓"} SpinnerPulse = []string{"█", "▓", "▒", "░"} SpinnerPoints = []string{"∙∙∙", "●∙∙", "∙●∙", "∙∙●", "∙∙∙"} SpinnerGlobe = []string{"🌍", "🌎", "🌏"} SpinnerMoon = []string{"🌑", "🌒", "🌓", "🌔", "🌕", "🌖", "🌗", "🌘"} SpinnerClock = []string{"🕛", "🕐", "🕑", "🕒", "🕓", "🕔", "🕕", "🕖", "🕗", "🕘", "🕙", "🕚"} SpinnerMonkey = []string{"🙈", "🙉", "🙊"} SpinnerStar = []string{"✶", "✸", "✹", "✺", "✹", "✸"} SpinnerHamburger = []string{"☱", "☲", "☴"} SpinnerGrowVertical = []string{" ", "▃", "▄", "▅", "▆", "▇", "█", "▇", "▆", "▅", "▄", "▃"} SpinnerGrowHorizontal = []string{"▉", "▊", "▋", "▌", "▍", "▎", "▏", "▎", "▍", "▌", "▋", "▊", "▉"} SpinnerArrow = []string{"←", "↖", "↑", "↗", "→", "↘", "↓", "↙"} SpinnerTriangle = []string{"◢", "◣", "◤", "◥"} SpinnerCircleHalves = []string{"◐", "◓", "◑", "◒"} SpinnerBouncingBall = []string{"⠁", "⠂", "⠄", "⡀", "⢀", "⠠", "⠐", "⠈"} )
Functions ¶
This section is empty.
Types ¶
type BarChart ¶
type BarChart struct {
ui.Block
BarColors []ui.Color
LabelStyles []ui.Style
NumStyles []ui.Style
NumFormatter func(float64) string
Data []float64
Labels []string
BarWidth int
BarGap int
MaxVal float64
}
BarChart represents a widget that displays a bar chart.
type Button ¶
type Button struct {
ui.Block
Text string
TextStyle ui.Style
ActiveStyle ui.Style
IsActive bool
OnClick func()
}
Button represents a clickable button widget.
func (*Button) Deactivate ¶
func (b *Button) Deactivate()
type Calendar ¶
type Calendar struct {
ui.Block
Month time.Month
Year int
CurrentDay int
SelectedDay int
HeaderStyle ui.Style
DayStyle ui.Style
}
func NewCalendar ¶
func NewCalendar() *Calendar
type Checkbox ¶
Checkbox represents a checkbox widget.
func NewCheckbox ¶
NewCheckbox returns a new Checkbox with the given label.
type DrawDirection ¶
type DrawDirection uint
DrawDirection represents the direction of drawing.
const ( DrawLeft DrawDirection = iota DrawRight )
type Flex ¶
type Flex struct {
ui.Block
Items []*flexItem
Direction FlexDirection
}
Flex represents a flex container widget.
type FlexDirection ¶
type FlexDirection int
FlexDirection represents the direction of the flex container.
const ( FlexRow FlexDirection = iota FlexColumn )
type FunnelChart ¶
type FunnelChart struct {
ui.Block
Data []float64
Labels []string
Colors []ui.Color
UniformHeight bool
}
FunnelChart represents a widget that displays a funnel chart.
func (*FunnelChart) Draw ¶
func (fc *FunnelChart) Draw(buf *ui.Buffer)
Draw draws the funnel chart to the buffer.
type Gauge ¶
type Gauge struct {
ui.Block
Percent int
BarColor ui.Color
Label string
LabelStyle ui.Style // Style for labels outside the filled bar
BarLabelStyle ui.Style // Style for labels inside the filled bar
Gradient ui.Gradient
}
Gauge represents a widget that displays a progress bar.
type Heatmap ¶
type Heatmap struct {
ui.Block
Data [][]float64
CellWidth int
CellGap int
XLabels []string
YLabels []string
Colors []ui.Color
TextColor ui.Style
}
Heatmap represents a widget that displays a heat map.
type Image ¶
type Image struct {
ui.Block
Image image.Image
Monochrome bool
MonochromeThreshold uint8
MonochromeInvert bool
}
Image represents a widget that displays an image.
type Input ¶
type Input struct {
ui.Block
Text string
TextStyle ui.Style
CursorStyle ui.Style
Placeholder string
EchoMode EchoMode
Cursor int
sync.Mutex
// contains filtered or unexported fields
}
Input represents a text input widget.
func (*Input) InsertRune ¶
func (*Input) MoveCursorLeft ¶
func (i *Input) MoveCursorLeft()
func (*Input) MoveCursorRight ¶
func (i *Input) MoveCursorRight()
type LineGauge ¶
type LineGauge struct {
ui.Block
Percent int
LineColor ui.Color
Label string
LabelStyle ui.Style
LabelAlignment ui.Alignment
BarRune rune
BarRuneEmpty rune
}
LineGauge represents a widget that displays a line gauge.
type List ¶
type List struct {
ui.Block
Rows []string
WrapText bool
TextStyle ui.Style
SelectedStyle ui.Style
TextAlignment ui.Alignment
SelectedRow int
Gradient ui.Gradient
// contains filtered or unexported fields
}
List represents a widget that displays a list of items.
func (*List) ScrollAmount ¶
ScrollAmount scrolls the list by the given amount.
func (*List) ScrollBottom ¶
func (l *List) ScrollBottom()
ScrollBottom scrolls the list to the bottom.
func (*List) ScrollHalfPageDown ¶
func (l *List) ScrollHalfPageDown()
ScrollHalfPageDown scrolls the list down by half a page.
func (*List) ScrollHalfPageUp ¶
func (l *List) ScrollHalfPageUp()
ScrollHalfPageUp scrolls the list up by half a page.
func (*List) ScrollPageDown ¶
func (l *List) ScrollPageDown()
ScrollPageDown scrolls the list down by one page.
func (*List) ScrollPageUp ¶
func (l *List) ScrollPageUp()
ScrollPageUp scrolls the list up by one page.
type Modal ¶
type Modal struct {
ui.Block
Text string
TextStyle ui.Style
Buttons []*Button
ActiveButtonIndex int
}
Modal represents a widget that displays a modal dialog.
type Paragraph ¶
type Paragraph struct {
ui.Block
Text string
TextStyle ui.Style
WrapText bool
VerticalAlignment ui.VerticalAlignment
TextAlignment ui.Alignment
Gradient ui.Gradient
}
Paragraph represents a widget that displays a paragraph of text.
type PieChart ¶
type PieChart struct {
ui.Block
Data []float64
Colors []ui.Color
LabelFormatter PieChartLabel
AngleOffset float64
InnerRadius float64
}
PieChart represents a widget that displays a pie chart.
type PieChartLabel ¶
PieChartLabel is a function that returns a label for a pie chart slice.
type Plot ¶
type Plot struct {
ui.Block
Data [][]float64
DataLabels []string
MaxVal float64
LineColors []ui.Color
AxesColor ui.Color
ShowAxes bool
Fill bool
Marker PlotMarker
DotMarkerRune rune
PlotType PlotType
HorizontalScale int
DrawDirection DrawDirection
}
Plot represents a widget that displays a plot.
type PlotMarker ¶
type PlotMarker uint
PlotMarker represents the marker type for the plot.
const ( MarkerBraille PlotMarker = iota MarkerDot )
type RadarChart ¶
type RadarChart struct {
ui.Block
Data [][]float64
DataLabels []string
Labels []string
MaxVal float64
LineColors []ui.Color
LabelStyle ui.Style
DotStyle ui.Style
}
RadarChart represents a widget that displays a radar chart.
func (*RadarChart) Draw ¶
func (rc *RadarChart) Draw(buf *ui.Buffer)
Draw draws the radar chart to the buffer.
type Scrollbar ¶
type Scrollbar struct {
ui.Block
Orientation ScrollbarOrientation
Max int
Current int
PageSize int
ThumbStyle ui.Style
TrackStyle ui.Style
ThumbRune rune
TrackRune rune
BeginRune rune
EndRune rune
}
Scrollbar represents a widget that displays a scrollbar.
type ScrollbarOrientation ¶
type ScrollbarOrientation int
ScrollbarOrientation represents the orientation of the scrollbar.
const ( ScrollbarVertical ScrollbarOrientation = iota ScrollbarHorizontal )
type Sparkline ¶
type Sparkline struct {
Data []float64
Title string
TitleStyle ui.Style
LineColor ui.Color
BackgroundColor ui.Color
MaxVal float64
MaxHeight int
}
Sparkline represents a single sparkline.
type SparklineGroup ¶
SparklineGroup represents a group of sparklines.
func NewSparklineGroup ¶
func NewSparklineGroup(sls ...*Sparkline) *SparklineGroup
NewSparklineGroup returns a new SparklineGroup.
func (*SparklineGroup) Draw ¶
func (sg *SparklineGroup) Draw(buf *ui.Buffer)
Draw draws the sparkline group to the buffer.
type Spinner ¶
type Spinner struct {
ui.Block
Frames []string
Index int
Label string
LabelOnRight bool
FormatString string
TextStyle ui.Style
}
Spinner represents a widget that displays a spinner.
type StackedBarChart ¶
type StackedBarChart struct {
ui.Block
BarColors []ui.Color
LabelStyles []ui.Style
NumStyles []ui.Style
NumFormatter func(float64) string
Data [][]float64
Labels []string
BarWidth int
BarGap int
MaxVal float64
}
StackedBarChart represents a widget that displays a stacked bar chart.
func NewStackedBarChart ¶
func NewStackedBarChart() *StackedBarChart
NewStackedBarChart returns a new StackedBarChart.
func (*StackedBarChart) Draw ¶
func (sbc *StackedBarChart) Draw(buf *ui.Buffer)
Draw draws the stacked bar chart to the buffer.
type StepChart ¶
StepChart represents a stepped line chart
func NewStepChart ¶
func NewStepChart() *StepChart
NewStepChart returns a new StepChart initialized with default settings for a solid-line step graph.
type TabPane ¶
type TabPane struct {
ui.Block
TabNames []string
ActiveTabIndex int
ActiveTabStyle ui.Style
InactiveTabStyle ui.Style
PadLeft int
PadRight int
TabGap int
Separator string
}
TabPane represents a widget that displays a list of tabs.
func (*TabPane) FocusLeft ¶
func (tp *TabPane) FocusLeft()
FocusLeft moves the focus to the left tab.
func (*TabPane) FocusRight ¶
func (tp *TabPane) FocusRight()
FocusRight moves the focus to the right tab.
type Table ¶
type Table struct {
ui.Block
Rows [][]string
ColumnWidths []int
TextStyle ui.Style
RowSeparator bool
TextAlignment ui.Alignment
RowStyles map[int]ui.Style
FillRow bool
// TextWrap wraps the text in each cell.
TextWrap bool
ColumnResizer func()
// Selection and Styling
SelectedRow int
SelectedRowStyle ui.Style
CursorColor ui.Color
ShowCursor bool
ShowLocation bool
// contains filtered or unexported fields
}
Table represents a widget that displays a table.
func (*Table) ScrollBottom ¶
func (tb *Table) ScrollBottom()
ScrollBottom scrolls the list to the bottom.
func (*Table) ScrollDown ¶
func (tb *Table) ScrollDown()
ScrollDown scrolls the list down by one row.
func (*Table) ScrollPageDown ¶
func (tb *Table) ScrollPageDown()
ScrollPageDown scrolls the list down by one page.
func (*Table) ScrollPageUp ¶
func (tb *Table) ScrollPageUp()
ScrollPageUp scrolls the list up by one page.
type TextArea ¶
type TextArea struct {
ui.Block
Text string
TextStyle ui.Style
CursorStyle ui.Style
Cursor image.Point
ShowCursor bool
sync.Mutex
// contains filtered or unexported fields
}
TextArea represents a widget that displays a text area.
func (*TextArea) DeleteRune ¶
func (ta *TextArea) DeleteRune()
DeleteRune deletes the rune at the cursor position.
func (*TextArea) InsertNewline ¶
func (ta *TextArea) InsertNewline()
InsertNewline inserts a newline at the cursor position.
func (*TextArea) InsertRune ¶
InsertRune inserts a rune at the cursor position.
func (*TextArea) MoveCursor ¶
MoveCursor moves the cursor by the given amount.
type Tree ¶
type Tree struct {
ui.Block
TextStyle ui.Style
SelectedRowStyle ui.Style
WrapText bool
SelectedRow int
// contains filtered or unexported fields
}
Tree represents a widget that displays a tree of items.
func (*Tree) CollapseAll ¶
func (t *Tree) CollapseAll()
CollapseAll collapses all nodes in the tree.
func (*Tree) ScrollAmount ¶
ScrollAmount scrolls the tree by the given amount.
func (*Tree) ScrollBottom ¶
func (t *Tree) ScrollBottom()
ScrollBottom scrolls the tree to the bottom.
func (*Tree) ScrollHalfPageDown ¶
func (t *Tree) ScrollHalfPageDown()
ScrollHalfPageDown scrolls the tree down by half a page.
func (*Tree) ScrollHalfPageUp ¶
func (t *Tree) ScrollHalfPageUp()
ScrollHalfPageUp scrolls the tree up by half a page.
func (*Tree) ScrollPageDown ¶
func (t *Tree) ScrollPageDown()
func (*Tree) ScrollPageUp ¶
func (t *Tree) ScrollPageUp()
func (*Tree) SelectedNode ¶
SelectedNode returns the currently selected node.
func (*Tree) ToggleExpand ¶
func (t *Tree) ToggleExpand()
ToggleExpand toggles the expansion state of the selected node.
func (*Tree) Walk ¶
func (t *Tree) Walk(fn TreeWalkFn)
Walk walks the tree, calling fn for each node.
type TreeMap ¶
type TreeMap struct {
ui.Block
Root *TreeMapNode
TextColor ui.Color
}
TreeMap represents a widget that displays a tree map.
type TreeMapNode ¶
type TreeMapNode struct {
Value float64
Label string
Children []*TreeMapNode
Style ui.Style
X, Y, W, H int
}
TreeMapNode represents a node in the tree map.
type TreeNode ¶
type TreeNode struct {
Value fmt.Stringer
Expanded bool
Nodes []*TreeNode
// contains filtered or unexported fields
}
TreeNode represents a node in the tree.
type TreeWalkFn ¶
TreeWalkFn is a function that is called for each node in the tree during a walk.