Widgetui

A bevy like widget system for Ratatui and Crossterm

Installation

Run the following within your project directory bash cargo add widgetui cargo add ratatui cargo add crossterm

Introduction

Widgetui is a wrapper over Ratatui's Crossterm backend which allows for powerful abstraction, and simplifies creating a good app within Ratatui.

Why pick this over Ratatui?

Widgetui isn't meant to replace or undermine Ratatui. It is simply a wrapper. Without Ratatui, this crate would not exist, as well, you will still require Ratatui and Crossterm crates just to work with the apps.

TLDR; Don't, use both together to improve developer experience, and build your apps faster!

Quickstart

```rust use ratatui::widgets::Paragraph;

use widgetui::*;

use std::{cell::RefMut, error::Error};

fn widget(frame: &mut WidgetFrame, mut events: RefMut) -> WidgetResult { frame.render_widget(Paragraph::new("Hello, world!", frame.size()));

if events.key(crossterm::event::KeyCode::Char('q')) {
    events.register_exit();
}

Ok(())

}

fn main() -> Result<(), Box> { App::new(100)?.with_widget(widget).run() } ```

The above will create an application that will display an empty terminal window, then close once you press q.

This application, with many less lines, will render the same thing that Ratatui's Quickstart renders.

Documentation

Documentation can be found on docs.rs.

Fun Facts