Skip to content

gyscos/cursive

Repository files navigation

Cursive

crates.io Rust MIT licensed Gitter chat

Cursive is a TUI (Text User Interface) library for rust. It uses the crossterm backend by default, but other backends are available.

It allows you to build rich user interfaces for terminal applications.

It is designed to be safe and easy to use:

[dependencies]
cursive = "0.21"

Or to use the latest git version:

[dependencies]
cursive = { git = "https://github.com/gyscos/cursive" }
use cursive::views::{Dialog, TextView};

fn main() {
    // Creates the cursive root - required for every application.
    let mut siv = cursive::default();

    // Creates a dialog with a single "Quit" button
    siv.add_layer(Dialog::around(TextView::new("Hello Dialog!"))
                         .title("Cursive")
                         .button("Quit", |s| s.quit()));

    // Starts the event loop.
    siv.run();
}

Cursive dialog example

Check out the other examples to get these results, and more:

lorem.rs example menubar.rs example select.rs example mines example theme_manual.rs example syntect example

(Colors may depend on your terminal configuration.)

Tutorials

These tutorials may help you get started with cursive:

Third-party views