Categorygithub.com/marcusolsson/tui-go
modulepackage
0.4.0
Repository: https://github.com/marcusolsson/tui-go.git
Documentation: pkg.go.dev

# README

tui: Terminal UI for Go

Build Status GoDoc Go Report Card License MIT

A UI library for terminal applications.

tui (pronounced tooey) provides a higher-level programming model for building rich terminal applications. It lets you build layout-based user interfaces that (should) gracefully handle resizing for you.

IMPORTANT: tui-go is still in an experimental phase so please don't use it for anything other than experiments, yet.

Update: I created tui-go as an experiment because I wanted a simpler way of creating terminal-based user interfaces. It has since then become a project, with all the work that comes with it. While it's been really fun, unfortunately I'm no longer able to maintain this project.

Since I started working on tui-go, a number of similar projects have popped up. One that I think shows great promise is rivo/tview, which embodies much of what I envisioned for tui-go. I highly recommend trying it out!

Thanks all of you who have contributed and supported tui-go!

Screenshot

Installation

go get github.com/marcusolsson/tui-go

Usage

package main

import "github.com/marcusolsson/tui-go"

func main() {
	box := tui.NewVBox(
		tui.NewLabel("tui-go"),
	)

	ui, err := tui.New(box)
	if err != nil {
		panic(err)
	}
	ui.SetKeybinding("Esc", func() { ui.Quit() })

	if err := ui.Run(); err != nil {
		panic(err)
	}
}

Getting started

If you want to know what it is like to build terminal applications with tui-go, check out some of the examples.

Documentation is available at godoc.org.

Make sure you check out some of the projects using tui-go.

Once you've gotten started developing your first application with tui-go, you might be interested in learning about common patterns or how you can debug your applications.

Related projects

tui-go is mainly influenced by Qt and offers a similar programming model that has been adapted to Go and the terminal.

For an overview of the alternatives for writing terminal user interfaces, check out this article by AppliedGo.

License

tui-go is released under the MIT License.

Contact

If you're interested in chatting with users and contributors, join #tui-go on the Gophers Slack. If you're not already a part of the Slack workspace, you can join here. If you prefer a lower-bandwidth interface, see this article on connecting to Slack via IRC or XMPP.

# Packages

# Functions

New returns a new UI with a root widget.
NewButton returns a new Button with the given text as the label.
NewEntry returns a new Entry.
NewGrid returns a new Grid.
NewHBox returns a new horizontally aligned Box.
NewLabel returns a new Label.
NewList returns a new List with no selection.
NewPadder returns a new Padder.
NewPainter returns a new instance of Painter.
NewProgress returns a new Progress.
NewScrollArea returns a new ScrollArea.
NewSpacer returns a new Spacer.
NewStatusBar returns a new StatusBar.
NewTable returns a new Table.
NewTestSurface returns a new TestSurface.
NewTextEdit returns a new TextEdit.
NewTheme return an empty theme.
NewVBox returns a new vertically aligned Box.
SetLogger sets the logger that is used in tui.

# Constants

Common colors.
Common colors.
Common colors.
Common colors.
Common colors.
Common colors.
Common colors.
Common colors.
Common colors.
Decoration modes: Inherit from parent widget, explicitly on, or explicitly off.
Decoration modes: Inherit from parent widget, explicitly on, or explicitly off.
Decoration modes: Inherit from parent widget, explicitly on, or explicitly off.
EchoModeNoEcho disables text display.
EchoModeNormal displays the characters as they're being entered.
EchoModePassword replaces all characters with asterisks.
Expanding makes the widget expand to the available space.
Available alignment options.
These are the defined ASCII values for key codes.
These are aliases for other keys.
These are aliases for other keys.
These are named keys that can be handled.
These are the defined ASCII values for key codes.
These are the defined ASCII values for key codes.
These are the defined ASCII values for key codes.
These are named keys that can be handled.
These are named keys that can be handled.
These are named keys that can be handled.
These are the defined ASCII values for key codes.
These are the supported control keys.
These are the supported control keys.
These are the supported control keys.
These are the supported control keys.
These are the supported control keys.
These are the supported control keys.
These are the supported control keys.
These are the supported control keys.
These are the supported control keys.
These are the supported control keys.
These are the supported control keys.
These are the supported control keys.
These are the supported control keys.
These are the supported control keys.
Escape.
These are the supported control keys.
These are the supported control keys.
These are the supported control keys.
These are the supported control keys.
These are the supported control keys.
These are the supported control keys.
These are the supported control keys.
These are the supported control keys.
These are the supported control keys.
These are the supported control keys.
These are the supported control keys.
These are the supported control keys.
These are the supported control keys.
These are the supported control keys.
These are the supported control keys.
These are the supported control keys.
These are the supported control keys.
These are the defined ASCII values for key codes.
These are the defined ASCII values for key codes.
These are the defined ASCII values for key codes.
These are the defined ASCII values for key codes.
These are the defined ASCII values for key codes.
These are named keys that can be handled.
These are the defined ASCII values for key codes.
These are named keys that can be handled.
These are named keys that can be handled.
These are named keys that can be handled.
These are the defined ASCII values for key codes.
These are named keys that can be handled.
These are the defined ASCII values for key codes.
These are aliases for other keys.
These are the defined ASCII values for key codes.
These are aliases for other keys.
These are the defined ASCII values for key codes.
These are aliases for other keys.
These are the defined ASCII values for key codes.
These are the defined ASCII values for key codes.
These are named keys that can be handled.
These are named keys that can be handled.
These are named keys that can be handled.
These are named keys that can be handled.
These are named keys that can be handled.
These are named keys that can be handled.
These are named keys that can be handled.
These are named keys that can be handled.
These are named keys that can be handled.
These are named keys that can be handled.
These are named keys that can be handled.
These are named keys that can be handled.
These are named keys that can be handled.
These are named keys that can be handled.
These are named keys that can be handled.
These are named keys that can be handled.
These are named keys that can be handled.
These are named keys that can be handled.
These are named keys that can be handled.
These are named keys that can be handled.
These are named keys that can be handled.
These are named keys that can be handled.
These are named keys that can be handled.
These are named keys that can be handled.
These are named keys that can be handled.
These are named keys that can be handled.
These are named keys that can be handled.
These are named keys that can be handled.
These are named keys that can be handled.
These are named keys that can be handled.
These are named keys that can be handled.
These are named keys that can be handled.
These are named keys that can be handled.
These are named keys that can be handled.
These are named keys that can be handled.
These are named keys that can be handled.
These are named keys that can be handled.
These are named keys that can be handled.
These are named keys that can be handled.
These are named keys that can be handled.
These are named keys that can be handled.
These are named keys that can be handled.
These are named keys that can be handled.
These are named keys that can be handled.
These are named keys that can be handled.
These are named keys that can be handled.
These are named keys that can be handled.
These are named keys that can be handled.
These are named keys that can be handled.
These are named keys that can be handled.
These are named keys that can be handled.
These are named keys that can be handled.
These are named keys that can be handled.
These are named keys that can be handled.
These are named keys that can be handled.
These are named keys that can be handled.
These are named keys that can be handled.
These are named keys that can be handled.
These are named keys that can be handled.
These are named keys that can be handled.
These are named keys that can be handled.
These are named keys that can be handled.
These are named keys that can be handled.
These are named keys that can be handled.
These are named keys that can be handled.
These are the defined ASCII values for key codes.
These are the defined ASCII values for key codes.
These are the defined ASCII values for key codes.
These are named keys that can be handled.
These are named keys that can be handled.
These are named keys that can be handled.
These are named keys that can be handled.
These are the defined ASCII values for key codes.
These are the defined ASCII values for key codes.
These are the defined ASCII values for key codes.
These are named keys that can be handled.
These are named keys that can be handled.
These are named keys that can be handled.
These are named keys that can be handled.
These are named keys that can be handled.
These are the defined ASCII values for key codes.
These are named keys that can be handled.
These are the defined ASCII values for key codes.
These are the defined ASCII values for key codes.
These are the defined ASCII values for key codes.
These are the defined ASCII values for key codes.
These are the defined ASCII values for key codes.
These are the defined ASCII values for key codes.
These are aliases for other keys.
These are the defined ASCII values for key codes.
These are named keys that can be handled.
These are named keys that can be handled.
These are named keys that can be handled.
These are the defined ASCII values for key codes.
These are the defined ASCII values for key codes.
Maximum allows the widget to grow up to the size hint.
Minimum allows the widget to shrink down to the size hint.
Modifiers that can be sent with a KeyEvent or a MouseEvent.
Modifiers that can be sent with a KeyEvent or a MouseEvent.
Modifiers that can be sent with a KeyEvent or a MouseEvent.
Modifiers that can be sent with a KeyEvent or a MouseEvent.
Modifiers that can be sent with a KeyEvent or a MouseEvent.
Preferred interprets the size hint as the preferred size.
Available alignment options.

# Variables

DefaultFocusChain is the default focus chain.
DefaultTheme is a theme with reasonable defaults.

# Structs

Box is a layout for placing widgets either horizontally or vertically.
Button is a widget that can be activated to perform some action, or to answer a question.
Entry
Entry is a one-line text editor.
Grid is a widget that lays out widgets in a grid.
KeyEvent represents a key press.
Label is a widget to display read-only text.
List is a widget for displaying and selecting items.
MouseEvent represents the event where a mouse button was pressed or released.
Padder is a widget to fill out space.
Painter provides operations to paint on a surface.
Progress is a widget to display a progress bar.
RuneBuffer provides readline functionality for text widgets.
ScrollArea is a widget to fill out space.
SimpleFocusChain represents a ring of widgets where focus is loops to the first widget when it reaches the end.
Spacer is a widget to fill out space.
StatusBar is a widget to display status information.
Style determines how a cell should be painted.
Table is a widget that lays out widgets in a table.
A TestSurface implements the Surface interface with local buffers, and provides accessors to check the output of a draw operation on the Surface.
TextEdit is a multi-line text editor.
Theme defines the styles for a set of identifiers.
WidgetBase defines base attributes and operations for all widgets.

# Interfaces

FocusChain enables custom focus traversal when Tab or Backtab is pressed.
Logger provides a interface for the standard logger.
Surface defines a surface that can be painted on.
UI defines the operations needed by the underlying engine.
Widget defines common operations on widgets.

# Type aliases

Alignment is used to set the direction in which widgets are laid out.
Color represents a color.
Decoration represents a bold/underline/etc.
EchoMode is used to determine the visibility of Entry text.
Key represents both normal and special keys.
ModMask is a mask of modifier keys.
SizePolicy determines the space occupied by a widget.