Skip to content

Latest commit

 

History

History

tui

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

TUI crate for text user interfaces

The Rust TUI (Text User Interface) crate provides user interface widgets and utilities for building command-line tool interfaces. The TUI crate includes components such as text input fields, progress bars, tables, and menus, which can be used to create interactive and dynamic command-line interfaces.

The Rust TUI crate is built on top of the Rust ncurses library and provides an abstraction layer that simplifies the creation of user interfaces. The library is cross-platform and can be run on a variety of operating systems.

Example:

use tui::Terminal;
use tui::backend::TermionBackend;
use termion::raw::IntoRawMode;

fn main() {
    // Create a Terminal with the TermionBackend
    let stdout = io::stdout().into_raw_mode().unwrap();
    let backend = TermionBackend::new(stdout);
    let mut terminal = Terminal::new(backend).unwrap();

    // Draw the UI
    terminal.draw(|f| {
        let size = f.size();
        let block = Block::default()
            .title("Block")
            .borders(Borders::ALL);
        f.render_widget(block, size);
    }).unwrap();
}

This code creates a new Terminal with TermionBackend and draws a simple block on it.