{"id":13471819,"url":"https://github.com/gcla/gowid","last_synced_at":"2025-05-14T20:05:14.907Z","repository":{"id":34712580,"uuid":"182000843","full_name":"gcla/gowid","owner":"gcla","description":"Compositional widgets for terminal user interfaces, written in Go, inspired by urwid.","archived":false,"fork":false,"pushed_at":"2023-02-23T09:29:58.000Z","size":622,"stargazers_count":700,"open_issues_count":7,"forks_count":33,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-04-06T11:05:59.300Z","etag":null,"topics":["go","golang","tcell","tui","urwid","widgets"],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gcla.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":"support.go","governance":null,"roadmap":null,"authors":null}},"created_at":"2019-04-18T02:18:54.000Z","updated_at":"2025-03-28T15:08:51.000Z","dependencies_parsed_at":"2024-01-16T06:09:19.627Z","dependency_job_id":"8ebdd4b2-3712-41ab-82fa-86876e4c1a6b","html_url":"https://github.com/gcla/gowid","commit_stats":{"total_commits":180,"total_committers":10,"mean_commits":18.0,"dds":0.06666666666666665,"last_synced_commit":"ce29e21d2804a03c65f51a57b397c9fda31a5c7b"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gcla%2Fgowid","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gcla%2Fgowid/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gcla%2Fgowid/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gcla%2Fgowid/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gcla","download_url":"https://codeload.github.com/gcla/gowid/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248724639,"owners_count":21151561,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["go","golang","tcell","tui","urwid","widgets"],"created_at":"2024-07-31T16:00:49.528Z","updated_at":"2025-04-13T14:06:14.839Z","avatar_url":"https://github.com/gcla.png","language":"Go","funding_links":[],"categories":["Misc","Go"],"sub_categories":[],"readme":"﻿# Terminal User Interface Widgets in Go\n\nGowid provides widgets and a framework for making terminal user interfaces. It's written in Go and inspired by [urwid](http://urwid.org). \n\nWidgets out-of-the-box include:\n\n - input components like button, checkbox and an editable text field with support for passwords\n - layout components for arranging widgets in columns, rows and a grid\n - structured components - a tree, an infinite list and a table\n - pre-canned widgets - a progress bar, a modal dialog, a bar graph and a menu\n - a VT220-compatible terminal widget, heavily cribbed from urwid :smiley:\n\nAll widgets support interaction with the mouse when the terminal allows.\n\nGowid is built on top of the fantastic [tcell](https://github.com/gdamore/tcell) package.\n\nThere are many alternatives to gowid - see [Similar Projects](#similar-projects)\n\nThe most developed gowid application is currently [termshark](https://termshark.io), a terminal UI for tshark.\n## Installation\n\n```bash\ngo get github.com/gcla/gowid/...\n```\n## Examples\n\nMake sure `$GOPATH/bin` is in your PATH (or `~/go/bin` if `GOPATH` isn't set), then tab complete \"gowid-\" e.g.\n\n```bash\ngowid-fib\n```\n\nHere is a port of urwid's [palette](https://github.com/urwid/urwid/blob/master/examples/palette_test.py) example:\n\n\u003ca href=\"https://drive.google.com/uc?export=view\u0026id=1wENPAEOOdPp6eeHvpH0TvYOYnl4Gmy9Q\"\u003e\u003cimg src=\"https://drive.google.com/uc?export=view\u0026id=1wENPAEOOdPp6eeHvpH0TvYOYnl4Gmy9Q\" style=\"width: 50px; max-width: 10%; height: auto\" title=\"Click for the larger version.\" /\u003e\u003c/a\u003e\n\nHere is urwid's [graph](https://github.com/urwid/urwid/blob/master/examples/graph.py) example:\n\n\u003ca href=\"https://drive.google.com/uc?export=view\u0026id=16p1NFrc3X3ReD-wz7bPXeYF8pCap3U-y\"\u003e\u003cimg src=\"https://drive.google.com/uc?export=view\u0026id=16p1NFrc3X3ReD-wz7bPXeYF8pCap3U-y\" style=\"width: 50px; max-width: 10%; height: auto\" title=\"Click for the larger version.\" /\u003e\u003c/a\u003e\n\nAnd urwid's [fibonacci](https://github.com/urwid/urwid/blob/master/examples/fib.py) example:\n\n\u003ca href=\"https://drive.google.com/uc?export=view\u0026id=1fPVYOWt7EMUP18ZQL78OFY7IXwmeeqUO\"\u003e\u003cimg src=\"https://drive.google.com/uc?export=view\u0026id=1fPVYOWt7EMUP18ZQL78OFY7IXwmeeqUO\" style=\"width: 500px; max-width: 100%; height: auto\" title=\"Click for the larger version.\" /\u003e\u003c/a\u003e\n\nA demonstration of gowid's terminal widget, a port of urwid's [terminal widget](https://github.com/urwid/urwid/blob/master/examples/terminal.py):\n\n\u003ca href=\"https://drive.google.com/uc?export=view\u0026id=1bRtgHoXcy0UESmKZK6JID8FIlkf5T7aL\"\u003e\u003cimg src=\"https://drive.google.com/uc?export=view\u0026id=1bRtgHoXcy0UESmKZK6JID8FIlkf5T7aL\" style=\"width: 500px; max-width: 100%; height: auto\" title=\"Click for the larger version.\" /\u003e\u003c/a\u003e\n\nFinally, here is an animation of termshark in action:\n\n\u003ca href=\"https://drive.google.com/uc?export=view\u0026id=1vDecxjqwJrtMGJjOObL-LLvi-1pBVByt\"\u003e\u003cimg src=\"https://drive.google.com/uc?export=view\u0026id=1vDecxjqwJrtMGJjOObL-LLvi-1pBVByt\" style=\"width: 500px; max-width: 100%; height: auto\" title=\"Click for the larger version.\" /\u003e\u003c/a\u003e\n\n## Hello World\n\nThis example is an attempt to mimic urwid's [\"Hello World\"](http://urwid.org/tutorial/index.html) example.\n\n```go\npackage main\n\nimport (\n\t\"github.com/gcla/gowid\"\n\t\"github.com/gcla/gowid/widgets/divider\"\n\t\"github.com/gcla/gowid/widgets/pile\"\n\t\"github.com/gcla/gowid/widgets/styled\"\n\t\"github.com/gcla/gowid/widgets/text\"\n\t\"github.com/gcla/gowid/widgets/vpadding\"\n)\n\n//======================================================================\n\nfunc main() {\n\n\tpalette := gowid.Palette{\n\t\t\"banner\":  gowid.MakePaletteEntry(gowid.ColorWhite, gowid.MakeRGBColor(\"#60d\")),\n\t\t\"streak\":  gowid.MakePaletteEntry(gowid.ColorNone, gowid.MakeRGBColor(\"#60a\")),\n\t\t\"inside\":  gowid.MakePaletteEntry(gowid.ColorNone, gowid.MakeRGBColor(\"#808\")),\n\t\t\"outside\": gowid.MakePaletteEntry(gowid.ColorNone, gowid.MakeRGBColor(\"#a06\")),\n\t\t\"bg\":      gowid.MakePaletteEntry(gowid.ColorNone, gowid.MakeRGBColor(\"#d06\")),\n\t}\n\n\tdiv := divider.NewBlank()\n\toutside := styled.New(div, gowid.MakePaletteRef(\"outside\"))\n\tinside := styled.New(div, gowid.MakePaletteRef(\"inside\"))\n\n\thelloworld := styled.New(\n\t\ttext.NewFromContentExt(\n\t\t\ttext.NewContent([]text.ContentSegment{\n\t\t\t\ttext.StyledContent(\"Hello World\", gowid.MakePaletteRef(\"banner\")),\n\t\t\t}),\n\t\t\ttext.Options{\n\t\t\t\tAlign: gowid.HAlignMiddle{},\n\t\t\t},\n\t\t),\n\t\tgowid.MakePaletteRef(\"streak\"),\n\t)\n\n\tf := gowid.RenderFlow{}\n\n\tview := styled.New(\n\t\tvpadding.New(\n\t\t\tpile.New([]gowid.IContainerWidget{\n\t\t\t\t\u0026gowid.ContainerWidget{IWidget: outside, D: f},\n\t\t\t\t\u0026gowid.ContainerWidget{IWidget: inside, D: f},\n\t\t\t\t\u0026gowid.ContainerWidget{IWidget: helloworld, D: f},\n\t\t\t\t\u0026gowid.ContainerWidget{IWidget: inside, D: f},\n\t\t\t\t\u0026gowid.ContainerWidget{IWidget: outside, D: f},\n\t\t\t}),\n\t\t\tgowid.VAlignMiddle{},\n\t\t\tf),\n\t\tgowid.MakePaletteRef(\"bg\"),\n\t)\n\n\tapp, _ := gowid.NewApp(gowid.AppArgs{\n\t\tView:    view,\n\t\tPalette: \u0026palette,\n\t})\n    \n\tapp.SimpleMainLoop()\n}\n```\n\nRunning the example above displays this:\n\n\u003ca href=\"https://drive.google.com/uc?export=view\u0026id=1P2kjWagHJmhtWLV0hPQti0fXKidr_WMB\"\u003e\u003cimg src=\"https://drive.google.com/uc?export=view\u0026id=1P2kjWagHJmhtWLV0hPQti0fXKidr_WMB\" style=\"width: 500px; max-width: 100%; height: auto\" title=\"Click for the larger version.\" /\u003e\u003c/a\u003e\n\n## Documentation\n\n - The beginnings of a [tutorial](docs/Tutorial.md)\n - A list of most of the [widgets](docs/Widgets.md)\n - Some [FAQs](docs/FAQ.md) (which I guessed at...)\n - Some gowid [programming tricks](docs/Debugging.md)\n \n## Similar Projects\n\nGowid is late to the TUI party. There are many options from which to choose - please read https://appliedgo.net/tui/ for a nice summary for the Go language. Here is a selection:\n\n - [urwid](http://urwid.org/) - one of the oldest, for those working in python\n - [tview](https://github.com/rivo/tview) - active, polished, concise, lots of widgets, Go\n - [termui](https://github.com/gizak/termui) - focus on graphing and dataviz, Go\n - [gocui](https://github.com/jroimartin/gocui) - focus on layout, good input options, mouse support, Go\n - [clui](https://github.com/VladimirMarkelov/clui) - active, many widgets, mouse support, Go\n - [tui-go](https://github.com/marcusolsson/tui-go) - QT-inspired, experimental, nice examples, Go\n\n## Dependencies\n\nGowid depends on these great open-source packages:\n\n- [urwid](http://urwid.org) - not a Go-dependency, but the model for most of gowid's design\n- [tcell](https://github.com/gdamore/tcell) - a cell based view for text terminals, like xterm, inspired by termbox\n- [asciigraph](https://github.com/guptarohit/asciigraph) - lightweight ASCII line-graphs for Go\n- [logrus](https://github.com/sirupsen/logrus) - structured pluggable logging for Go\n- [testify](https://github.com/stretchr/testify) - tools for testifying that your code will behave as you intend\n\n## Contact\n\n- The author - Graham Clark (grclark@gmail.com)\n\n## License\n\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgcla%2Fgowid","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgcla%2Fgowid","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgcla%2Fgowid/lists"}