• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

examples/H03-May-2022-2,7702,427

src/H03-May-2022-12,95711,327

tests/H03-May-2022-855785

.cargo-checksum.jsonH A D03-May-202289 11

.cargo_vcs_info.jsonH A D21-May-202074 65

.gitignoreH A D17-May-201957 76

CHANGELOG.mdH A D21-May-202010.5 KiB405289

Cargo.lockH A D21-May-202028.4 KiB637565

Cargo.tomlH A D21-May-20203.3 KiB164131

Cargo.toml.orig-cargoH A D21-May-20202.5 KiB128105

LICENSEH A D25-Nov-20181.1 KiB2217

MakefileH A D18-May-20202.9 KiB11467

README.mdH A D12-May-20204.1 KiB11179

README.md

1# tui-rs
2
3[![Build Status](https://github.com/fdehau/tui-rs/workflows/CI/badge.svg)](https://github.com/fdehau/tui-rs/actions?query=workflow%3ACI+)
4[![Crate Status](https://img.shields.io/crates/v/tui.svg)](https://crates.io/crates/tui)
5[![Docs Status](https://docs.rs/tui/badge.svg)](https://docs.rs/crate/tui/)
6
7<img src="./assets/demo.gif" alt="Demo cast under Linux Termite with Inconsolata font 12pt">
8
9`tui-rs` is a [Rust](https://www.rust-lang.org) library to build rich terminal
10user interfaces and dashboards. It is heavily inspired by the `Javascript`
11library [blessed-contrib](https://github.com/yaronn/blessed-contrib) and the
12`Go` library [termui](https://github.com/gizak/termui).
13
14The library itself supports four different backends to draw to the terminal. You
15can either choose from:
16
17  - [termion](https://github.com/ticki/termion)
18  - [rustbox](https://github.com/gchp/rustbox)
19  - [crossterm](https://github.com/crossterm-rs/crossterm)
20  - [pancurses](https://github.com/ihalila/pancurses)
21
22However, some features may only be available in one of the four.
23
24The library is based on the principle of immediate rendering with intermediate
25buffers. This means that at each new frame you should build all widgets that are
26supposed to be part of the UI. While providing a great flexibility for rich and
27interactive UI, this may introduce overhead for highly dynamic content. So, the
28implementation try to minimize the number of ansi escapes sequences generated to
29draw the updated UI. In practice, given the speed of `Rust` the overhead rather
30comes from the terminal emulator than the library itself.
31
32Moreover, the library does not provide any input handling nor any event system and
33you may rely on the previously cited libraries to achieve such features.
34
35### [Documentation](https://docs.rs/tui)
36
37### Demo
38
39The demo shown in the gif can be run with all available backends
40(`exmples/*_demo.rs` files). For example to see the `termion` version one could
41run:
42
43```
44cargo run --example termion_demo --release -- --tick-rate 200
45```
46
47where `tick-rate` is the UI refresh rate in ms.
48
49The UI code is in [examples/demo/ui.rs](examples/demo/ui.rs) while the
50application state is in [examples/demo/app.rs](examples/demo/app.rs).
51
52Beware that the `termion_demo` only works on Unix platforms. If you are a Windows user,
53you can see the same demo using the `crossterm` backend with the following command:
54
55```
56cargo run --example crossterm_demo --no-default-features --features="crossterm" --release -- --tick-rate 200
57```
58
59If the user interface contains glyphs that are not displayed correctly by your terminal, you may want to run
60the demo without those symbols:
61
62```
63cargo run --example crossterm_demo --no-default-features --features="crossterm" --release -- --tick-rate 200 --enhanced-graphics false
64```
65
66### Widgets
67
68The library comes with the following list of widgets:
69
70  * [Block](examples/block.rs)
71  * [Gauge](examples/gauge.rs)
72  * [Sparkline](examples/sparkline.rs)
73  * [Chart](examples/chart.rs)
74  * [BarChart](examples/barchart.rs)
75  * [List](examples/list.rs)
76  * [Table](examples/table.rs)
77  * [Paragraph](examples/paragraph.rs)
78  * [Canvas (with line, point cloud, map)](examples/canvas.rs)
79  * [Tabs](examples/tabs.rs)
80
81Click on each item to see the source of the example. Run the examples with with
82cargo (e.g. to run the demo `cargo run --example demo`), and quit by pressing `q`.
83
84You can run all examples by running `make run-examples`.
85
86### Third-party widgets
87
88* [tui-logger](https://github.com/gin66/tui-logger)
89
90### Apps using tui
91
92* [spotify-tui](https://github.com/Rigellute/spotify-tui)
93* [bandwhich](https://github.com/imsnif/bandwhich)
94* [kmon](https://github.com/orhun/kmon)
95* [ytop](https://github.com/cjbassi/ytop)
96* [zenith](https://github.com/bvaisvil/zenith)
97* [bottom](https://github.com/ClementTsang/bottom)
98* [oha](https://github.com/hatoo/oha)
99* [gitui](https://github.com/extrawurst/gitui)
100* [rust-sadari-cli](https://github.com/24seconds/rust-sadari-cli)
101* [desed](https://github.com/SoptikHa2/desed)
102
103### Alternatives
104
105You might want to checkout [Cursive](https://github.com/gyscos/Cursive) for an
106alternative solution to build text user interfaces in Rust.
107
108## License
109
110[MIT](LICENSE)
111