Versions in this module Expand all Collapse all v0 v0.15.0 Nov 27, 2026 v0.14.0 Nov 25, 2026 Changes in this version + var BorderASCII = Border + var BorderDouble = Border + var BorderRounded = Border + var BorderSingle = Border + var BorderThick = Border + var ErrInputClosed = errors.New("tui: input closed") + var ErrNotATerminal = errors.New("tui: not a terminal") + func KeyLabel(name string) string + type Align int + const AlignCenter + const AlignLeft + const AlignRight + type App struct + func New(root Widget, opts ...Option) *App + func (a *App) ActiveBindings() []*Binding + func (a *App) Busy(text string) (done func()) + func (a *App) Choose(title string, options []string, selected int, onChoose func(i int)) + func (a *App) Close(w Widget) + func (a *App) Confirm(title, message string, onYes func()) + func (a *App) EditText(title, value string, onSave func(text string)) *TextArea + func (a *App) Focus(w Focusable) + func (a *App) FocusNext(delta int) + func (a *App) Focused() Focusable + func (a *App) Go(work func() func()) + func (a *App) HandleKey(k Key) bool + func (a *App) Keymap() *Keymap + func (a *App) Layers() int + func (a *App) Menu(title string, items []MenuItem) + func (a *App) Notify(level Level, text string) + func (a *App) Notifyf(level Level, format string, args ...any) + func (a *App) Pop() + func (a *App) Post(fn func()) + func (a *App) Prompt(title, label, value string, onSubmit func(text string)) *Input + func (a *App) Push(w Widget, opts LayerOptions) + func (a *App) Quit() + func (a *App) QuitWith(err error) + func (a *App) Root() Widget + func (a *App) Run() error + func (a *App) SetRoot(w Widget) + func (a *App) ShowHelp() + func (a *App) Size() (width, height int) + func (a *App) Status() (notice *Notice, busy string) + func (a *App) Suspend() + func (a *App) Theme() Theme + type Binding struct + Action func() + Enabled func() bool + Group string + Help string + Hidden bool + Keys []string + func (b *Binding) Hide() *Binding + func (b *Binding) InGroup(group string) *Binding + func (b *Binding) Label() string + func (b *Binding) When(enabled func() bool) *Binding + type Bindings interface + Keymap func() *Keymap + type Border struct + Bottom string + BottomLeft string + BottomRight string + Left string + Right string + Top string + TopLeft string + TopRight string + type Box struct + func HBox(items ...Item) *Box + func VBox(items ...Item) *Box + func (b *Box) Add(items ...Item) + func (b *Box) Children() []Widget + func (b *Box) Draw(c Canvas) + func (b *Box) Gap(n int) *Box + func (b *Box) Hidden(w Widget) bool + func (b *Box) SetHidden(w Widget, hidden bool) + func (b *Box) Size(width, height int) (int, int) + type Button struct + OnPress func() + func NewButton(label string, onPress func()) *Button + func (b *Button) CanFocus() bool + func (b *Button) Draw(c Canvas) + func (b *Button) HandleKey(Key) bool + func (b *Button) HandleMouse(m Mouse) bool + func (b *Button) Keymap() *Keymap + func (b *Button) Press() + func (b *Button) SetDisabled(disabled bool) *Button + func (b *Button) SetLabel(label string) + func (b *Button) Size(width, _ int) (int, int) + type Canvas struct + func (c Canvas) App() *App + func (c Canvas) Box(border Border, style theme.Style, title, footer Line) Canvas + func (c Canvas) Draw(w Widget) + func (c Canvas) Fill(style theme.Style) + func (c Canvas) FillRow(x, y int, style theme.Style) + func (c Canvas) Focused(w Widget) bool + func (c Canvas) HasFocus(w Widget) bool + func (c Canvas) Height() int + func (c Canvas) Line(x, y int, l Line) int + func (c Canvas) ShowCursor(x, y int) + func (c Canvas) Sub(x, y, w, h int) Canvas + func (c Canvas) Text(x, y int, s string, style theme.Style) int + func (c Canvas) Theme() Theme + func (c Canvas) VScrollbar(x, offset, height, total int) + func (c Canvas) Width() int + func (c Canvas) WithStyle(base theme.Style) Canvas + type CheckList struct + OnChange func(i int) + func NewCheckList(options []string) *CheckList + func (l *CheckList) CanFocus() bool + func (l *CheckList) Checked() []bool + func (l *CheckList) Draw(c Canvas) + func (l *CheckList) HandleKey(Key) bool + func (l *CheckList) HandleMouse(m Mouse) bool + func (l *CheckList) Keymap() *Keymap + func (l *CheckList) SetChecked(i int, on bool) + func (l *CheckList) SetDisabled(disabled bool) *CheckList + func (l *CheckList) SetHorizontal(h bool) *CheckList + func (l *CheckList) Size(width, height int) (int, int) + func (l *CheckList) Toggle(i int) + func (l *CheckList) Values() []string + type Clicker interface + HandleMouse func(m Mouse) bool + type Column struct + Align Align + Grow int + Min int + Title string + Width int + type Container interface + Children func() []Widget + type Dialog struct + func NewDialog(title string, body Widget, buttons ...*Button) *Dialog + func (d *Dialog) Children() []Widget + func (d *Dialog) Draw(c Canvas) + func (d *Dialog) SetFooter(s string) *Dialog + func (d *Dialog) SetWidth(w int) *Dialog + func (d *Dialog) Size(width, height int) (int, int) + type Focusable interface + CanFocus func() bool + HandleKey func(k Key) bool + type Focuser interface + FocusChanged func(focused bool) + type Form struct + OnSubmit func() + func NewForm() *Form + func (f *Form) Add(label string, w Widget) *Form + func (f *Form) AddButtons(buttons ...*Button) *Form + func (f *Form) AddHint(label string, w Widget, hint string) *Form + func (f *Form) Children() []Widget + func (f *Form) Draw(c Canvas) + func (f *Form) Err() error + func (f *Form) Keymap() *Keymap + func (f *Form) Size(width, height int) (int, int) + func (f *Form) Submit() + type Headless struct + func NewHeadless(app *App, width, height int) *Headless + func (h *Headless) Click(x, y int) + func (h *Headless) Cursor() (x, y int) + func (h *Headless) Draw() + func (h *Headless) Feed(data string) + func (h *Headless) Lines() []string + func (h *Headless) Paste(text string) + func (h *Headless) Press(keys ...string) + func (h *Headless) Quit() (bool, error) + func (h *Headless) Resize(width, height int) + func (h *Headless) Screen() string + func (h *Headless) Settle(timeout time.Duration) + func (h *Headless) Type(text string) + func (h *Headless) Wheel(x, y, n int) + type Input struct + OnChange func(text string) + OnSubmit func(text string) + Validate func(text string) error + func NewInput() *Input + func (in *Input) CanFocus() bool + func (in *Input) Draw(c Canvas) + func (in *Input) Err() error + func (in *Input) HandleKey(k Key) bool + func (in *Input) HandleMouse(m Mouse) bool + func (in *Input) HandlePaste(text string) bool + func (in *Input) Keymap() *Keymap + func (in *Input) SetDisabled(disabled bool) *Input + func (in *Input) SetLimit(n int) *Input + func (in *Input) SetPlaceholder(s string) *Input + func (in *Input) SetSecret(secret bool) *Input + func (in *Input) SetSuggest(fn func(text string) []string) *Input + func (in *Input) SetValue(s string) + func (in *Input) Size(width, _ int) (int, int) + func (in *Input) TakesText() bool + func (in *Input) Value() string + type Item struct + func Fit(w Widget) Item + func Fixed(n int, w Widget) Item + func Grow(w Widget) Item + func GrowBy(weight int, w Widget) Item + type Key struct + Code KeyCode + Mod Mod + Rune rune + func ParseKey(name string) (Key, error) + func (k Key) Printable() bool + func (k Key) String() string + type KeyCode int + const KeyBackspace + const KeyDelete + const KeyDown + const KeyEnd + const KeyEnter + const KeyEscape + const KeyF1 + const KeyF10 + const KeyF11 + const KeyF12 + const KeyF2 + const KeyF3 + const KeyF4 + const KeyF5 + const KeyF6 + const KeyF7 + const KeyF8 + const KeyF9 + const KeyHome + const KeyInsert + const KeyLeft + const KeyPageDown + const KeyPageUp + const KeyRight + const KeyRune + const KeyTab + const KeyUp + type Keyed struct + func NewKeyed(child Widget) *Keyed + func (k *Keyed) Children() []Widget + func (k *Keyed) Draw(c Canvas) + func (k *Keyed) Keymap() *Keymap + func (k *Keyed) Size(width, height int) (int, int) + type Keymap struct + func NewKeymap() *Keymap + func (m *Keymap) Add(bindings ...*Binding) + func (m *Keymap) Bind(help string, action func(), keys ...string) *Binding + func (m *Keymap) Bindings() []*Binding + func (m *Keymap) Lookup(k Key) *Binding + func (m *Keymap) Unbind(key string) + type Label struct + func NewDynamic(fn func() []Line) *Label + func NewLabel(text string, style theme.Style) *Label + func NewLines(lines ...Line) *Label + func (l *Label) Draw(c Canvas) + func (l *Label) SetAlign(a Align) *Label + func (l *Label) SetLines(lines ...Line) + func (l *Label) SetText(text string, style theme.Style) + func (l *Label) SetWrap(wrap bool) *Label + func (l *Label) Size(width, height int) (int, int) + type LayerOptions struct + Focus Focusable + Height int + NoEscape bool + OnClose func() + Width int + type Legend struct + func NewLegend() *Legend + func (*Legend) Draw(c Canvas) + func (*Legend) Size(width, _ int) (int, int) + type Level int + const LevelError + const LevelInfo + const LevelSuccess + const LevelWarning + type Line []Span + func Text(s string, style theme.Style) Line + func TruncateLine(l Line, width int) Line + func WrapLine(l Line, width int) []Line + func WrapText(text string, width int, style theme.Style) []Line + func (l Line) String() string + func (l Line) Width() int + type List struct + OnCursor func(item T) + OnEnd func() + OnFilter func(filter string) + OnSelect func(item T) + func NewList[T any](cells func(item T) []Span) *List[T] + func (l *List[T]) AppendItems(items ...T) + func (l *List[T]) CanFocus() bool + func (l *List[T]) ClearMarks() + func (l *List[T]) Cursor() int + func (l *List[T]) Draw(c Canvas) + func (l *List[T]) Filter() string + func (l *List[T]) Filtering() bool + func (l *List[T]) HandleKey(k Key) bool + func (l *List[T]) HandleMouse(m Mouse) bool + func (l *List[T]) HandlePaste(text string) bool + func (l *List[T]) Items() []T + func (l *List[T]) Keymap() *Keymap + func (l *List[T]) Marked() []T + func (l *List[T]) Move(n int) + func (l *List[T]) Position() string + func (l *List[T]) Selected() (T, bool) + func (l *List[T]) SetColumns(columns ...Column) *List[T] + func (l *List[T]) SetCursor(i int) + func (l *List[T]) SetDisabled(disabled bool) *List[T] + func (l *List[T]) SetEmpty(text string) *List[T] + func (l *List[T]) SetFilter(s string) + func (l *List[T]) SetItems(items []T) + func (l *List[T]) SetLoading(loading bool) + func (l *List[T]) SetMatch(fn func(item T) string) *List[T] + func (l *List[T]) SetRowStyle(fn func(item T) theme.Style) *List[T] + func (l *List[T]) SetTotal(n int) + func (l *List[T]) Shown() []T + func (l *List[T]) TakesText() bool + type MenuItem struct + Action func() + Disabled bool + Key string + Label string + Separator bool + type Mod uint8 + const ModAlt + const ModCtrl + const ModShift + type Mouse struct + Action MouseAction + Button MouseButton + Mod Mod + X int + Y int + type MouseAction int + const MouseMotion + const MousePress + const MouseRelease + type MouseButton int + const MouseLeft + const MouseMiddle + const MouseNone + const MouseRight + const MouseWheelDown + const MouseWheelUp + type Notice struct + Level Level + Text string + type Option func(*App) + func WithMouse() Option + func WithTerminal(in, out *os.File) Option + func WithTheme(t Theme) Option + func WithoutHelp() Option + type Padded struct + func Pad(child Widget, top, right, bottom, left int) *Padded + func (p *Padded) Children() []Widget + func (p *Padded) Draw(c Canvas) + func (p *Padded) Size(width, height int) (int, int) + type Pages struct + OnChange func(name string) + func NewPages() *Pages + func (p *Pages) Add(name string, w Widget) + func (p *Pages) Children() []Widget + func (p *Pages) Current() string + func (p *Pages) Draw(c Canvas) + func (p *Pages) Names() []string + func (p *Pages) Page(name string) Widget + func (p *Pages) Show(name string) + type Panel struct + func NewPanel(title string, child Widget) *Panel + func (p *Panel) Child() Widget + func (p *Panel) Children() []Widget + func (p *Panel) Draw(c Canvas) + func (p *Panel) SetBorder(b Border) + func (p *Panel) SetFooter(l Line) + func (p *Panel) SetPadding(n int) + func (p *Panel) SetTitle(title string) + func (p *Panel) SetTitleLine(l Line) + func (p *Panel) Size(width, height int) (int, int) + type Paste struct + Text string + type Paster interface + HandlePaste func(text string) bool + type RadioGroup struct + OnChange func(i int) + func NewRadioGroup(options []string, selected int) *RadioGroup + func (r *RadioGroup) CanFocus() bool + func (r *RadioGroup) Draw(c Canvas) + func (r *RadioGroup) HandleKey(Key) bool + func (r *RadioGroup) HandleMouse(m Mouse) bool + func (r *RadioGroup) Keymap() *Keymap + func (r *RadioGroup) Select(i int) + func (r *RadioGroup) Selected() int + func (r *RadioGroup) SetDisabled(disabled bool) *RadioGroup + func (r *RadioGroup) SetHorizontal(h bool) *RadioGroup + func (r *RadioGroup) SetSelected(i int) + func (r *RadioGroup) Size(width, height int) (int, int) + func (r *RadioGroup) Value() string + type Resize struct + Height int + Width int + type Select struct + OnChange func(i int) + func NewSelect(title string, options []string, selected int) *Select + func (s *Select) CanFocus() bool + func (s *Select) Draw(c Canvas) + func (s *Select) HandleKey(Key) bool + func (s *Select) HandleMouse(m Mouse) bool + func (s *Select) Keymap() *Keymap + func (s *Select) Open() + func (s *Select) Selected() int + func (s *Select) SetDisabled(disabled bool) *Select + func (s *Select) SetSelected(i int) + func (s *Select) Size(width, _ int) (int, int) + func (s *Select) Value() string + type Sizer interface + Size func(width, height int) (w, h int) + type Spacer struct + func (Spacer) Draw(Canvas) + type Span struct + Style theme.Style + Text string + func Badge(s string, style theme.Style) Span + type StatusBar struct + func NewStatusBar(left, right func() Line) *StatusBar + func (*StatusBar) Size(width, _ int) (int, int) + func (s *StatusBar) Draw(c Canvas) + type Tabs struct + func NewTabs() *Tabs + func (t *Tabs) AddTab(name, title string, w Widget) + func (t *Tabs) Draw(c Canvas) + func (t *Tabs) Keymap() *Keymap + type TextArea struct + OnChange func(text string) + func NewTextArea() *TextArea + func (t *TextArea) CanFocus() bool + func (t *TextArea) Draw(c Canvas) + func (t *TextArea) HandleKey(k Key) bool + func (t *TextArea) HandleMouse(m Mouse) bool + func (t *TextArea) HandlePaste(text string) bool + func (t *TextArea) Keymap() *Keymap + func (t *TextArea) Len() int + func (t *TextArea) Limit() int + func (t *TextArea) SetDisabled(disabled bool) *TextArea + func (t *TextArea) SetLimit(n int) *TextArea + func (t *TextArea) SetPlaceholder(s string) *TextArea + func (t *TextArea) SetValue(s string) + func (t *TextArea) TakesText() bool + func (t *TextArea) Value() string + type Theme struct + Accent theme.Style + Border theme.Style + Cursor theme.Style + CursorBlurred theme.Style + Dialog theme.Style + Error theme.Style + Field theme.Style + FieldFocused theme.Style + FocusBorder theme.Style + Header theme.Style + Info theme.Style + Key theme.Style + KeyHelp theme.Style + Marked theme.Style + Match theme.Style + Muted theme.Style + Off theme.Style + On theme.Style + ScrollThumb theme.Style + Scrollbar theme.Style + StatusBar theme.Style + Success theme.Style + Text theme.Style + Title theme.Style + Warning theme.Style + func DefaultTheme() Theme + func ThemeFrom(t theme.Theme) Theme + type Toggle struct + OnChange func(on bool) + func NewCheckbox(label string, on bool) *Toggle + func NewSwitch(label string, on bool) *Toggle + func (t *Toggle) CanFocus() bool + func (t *Toggle) Draw(c Canvas) + func (t *Toggle) Flip() + func (t *Toggle) HandleKey(Key) bool + func (t *Toggle) HandleMouse(m Mouse) bool + func (t *Toggle) Keymap() *Keymap + func (t *Toggle) SetDisabled(disabled bool) *Toggle + func (t *Toggle) SetLabel(label string) + func (t *Toggle) SetValue(on bool) + func (t *Toggle) Size(width, _ int) (int, int) + func (t *Toggle) Value() bool + type Viewport struct + func NewViewport() *Viewport + func (v *Viewport) Append(lines ...Line) + func (v *Viewport) CanFocus() bool + func (v *Viewport) Draw(c Canvas) + func (v *Viewport) HandleKey(k Key) bool + func (v *Viewport) HandleMouse(m Mouse) bool + func (v *Viewport) HandlePaste(text string) bool + func (v *Viewport) Keymap() *Keymap + func (v *Viewport) Position() string + func (v *Viewport) ScrollBottom() + func (v *Viewport) ScrollBy(n int) + func (v *Viewport) ScrollToLine(n int) + func (v *Viewport) ScrollTop() + func (v *Viewport) SetDisabled(disabled bool) *Viewport + func (v *Viewport) SetFollow(follow bool) *Viewport + func (v *Viewport) SetLines(lines []Line) + func (v *Viewport) SetText(text string, style theme.Style) + func (v *Viewport) TakesText() bool + type Widget interface + Draw func(c Canvas)