gitmyhub

cursive

Rust ★ 4.8k updated 2d ago

A Text User Interface library for the Rust programming language

Cursive is a Rust library for building terminal user interfaces with ready-made widgets like buttons, menus, dialogs, and input fields, no graphical window needed. Works on Windows, macOS, and Linux.

Rustcrosstermcrates.ioTUIsetup: easycomplexity 3/5

Cursive is a Rust library for building text-based user interfaces that run inside a terminal window. Instead of a graphical window with pixels and mouse clicks, a TUI application uses characters, boxes drawn from text symbols, and keyboard navigation to create menus, dialogs, buttons, and input fields. This style of interface was common before graphical desktops and remains useful for tools that run over SSH, in CI environments, or anywhere a standard window system is not available.

The library provides ready-made building blocks called views. These include text labels, text input fields, scrollable areas, select lists, checkboxes, dialog boxes with buttons, and menu bars. You compose your interface by layering and nesting these views. A short example in the README shows creating a dialog with a title, a text message, and a quit button in around eight lines of code. The library handles keyboard events, focus management, and redrawing the screen when content changes.

Cursive works with multiple terminal backends. The default is crossterm, which supports Windows, macOS, and Linux without extra dependencies. Other backends can be swapped in for projects that already use a different terminal library. The community has published additional view types as separate crates covering things like calendar pickers, image display, tabs, tables, and a tmux-style multiplexer.

The showcase section of the README lists real applications built with Cursive, ranging from a Spotify client and a Tetris game to a Stack Overflow browser and a password manager. This gives a sense of the range of complexity the library can handle. A three-part written tutorial is included in the repository for getting started. The library is licensed under MIT and is available on crates.io, the standard Rust package registry.

Where it fits