tui
Version, currently 0.5.16 versions
github.com/threez/tui.cr
Minimal Crystal TUI primitives.
Installation
# Add this to your shard.yml
dependencies:
tui:
github: threez/tui.cr
version: ~> 0.5.1Then run:
shards installshard.yml
- Crystal
>= 1.19.1- License
- MIT
- Author
- Vincent Landgraf
Dependencies
Development Dependencies
- ameba~> 1.7github: crystal-ameba/amebadev
README
tui.cr
Minimal Crystal TUI primitives: a diffing screen compositor, a handful of
composable widgets (lists, tables, detail views, scrollable panes, splits,
modals), and an app-shell (Runtime) that owns terminal lifecycle and the
render/read-key/dispatch loop.
See doc/architecture.md for the layering
overview, which links out to doc/rendering.md (the
render/input pipelines), doc/widgets.md (the full
widget catalog), doc/app-shell.md (NavStack/
Runtime), and doc/dsl.md (the macro-based DSL layer).
Installation
dependencies:
tui:
path: threez/tui.cr
Hello, world
Every app builds its own Widget subclass, wraps it in a NavStack, and
hands both to Runtime, which owns the terminal lifecycle and the
render/read-key/dispatch loop:
require "tui"
class Hello < TUI::Widget
def render : Nil
@buffer.set(0, 0, "Hello, World! (press q to quit)")
end
def handle_key(ev : TUI::KeyEvent) : Bool
false # unconsumed
end
def status_hint : String
"q:quit"
end
end
screen = TUI::Screen.new
nav = TUI::NavStack(TUI::Widget).new(Hello.new(1, 1, screen.cols, screen.rows).as(TUI::Widget))
runtime = TUI::Runtime.new(screen, nav, ->(ev : TUI::KeyEvent) {
exit if ev.key == TUI::Key::Char && ev.char == 'q'
})
runtime.run
Run it in a real terminal — Runtime takes over the whole screen (alt
screen, raw mode, mouse reporting) until the process exits.
Example app
example/ contains a larger "widget browser" exercising most of the
library's widgets end to end against fabricated in-memory data. Run it with:
make example
# or: crystal run example/widget_browser.cr
Testing
crystal spec
crystal build --no-codegen src/tui.cr # fast compile-only check
Documentation
Built from the current release. The first visit to a release nobody has asked for starts its build.
Links
This release
- Version
0.5.1- Tagged
- Oct 11, 2026
- Commit
8dd567f3a3f9- Crystal
>= 1.19.1- Indexed
- yes
Dependents
Repository
github.com/threez/tui.cr
Metadata
- Created
- Aug 19, 2026
- Updated
- Oct 22, 2026
- Synced
- Oct 22, 2026
- Versions
- 6