Skip to content

Cursive vs tui‐rs

Alexandre Bury edited this page Mar 4, 2019 · 1 revision

Cursive and tui-rs are both making TUIs easier to write, and while they may look like competitors, they focus on different key aspects.

Shared features

Both libraries are great! Both also work on linux, macOS and windows.

If you're writing a full-screen terminal UI, using one of these libraries will be much easier than using ncurses or another low-level terminal handling library.

tui-rs

Tui-rs uses an "immediate-mode"-UI: the user handles the event loop, the application state, and re-draws the entire UI on each iteration. It does not handle input; users should use another library (like crossterm) or use stdin directly.

As a result, it is well suited for flat dashboards, and other often-refreshing applications with little interaction.

Cursive

Cursive uses a more declarative UI: the user defines the layout, then cursive handles the event loop. Cursive also handles most input (including mouse clicks), and forwards events to the currently focused view. User-code is more focused on "events" than on keyboard input.

It is well suited for more complex applications, with nested view trees, menus and pop-up windows.