Skip to main content

Crate minui

Crate minui 

Source
Expand description

§MinUI - A Minimal Terminal UI Framework

MinUI is a lightweight terminal UI framework for building traditional terminal applications. It focuses on simplicity and ease of use while providing the essential tools you need to create responsive, interactive terminal interfaces.

§What MinUI Offers

  • Event-driven terminal applications with optional timed updates (fixed tick rate) for animations
  • Simple widget system with containers, labels, panels, and text blocks
  • Full color support (RGB, ANSI, named colors)
  • Cross-platform keyboard and mouse input
  • Buffered rendering for smooth updates
  • Experimental game utilities (sprites/tiles/maps/collision) — expect breaking changes

§Quick Start

use minui::prelude::*;

let mut app = App::new(())?;

app.run(
    |_state, event| {
        // Return false to exit on 'q' key
        !matches!(event, Event::Character('q'))
    },
    |_state, window| {
        let label = Label::new("Hello, MinUI!");
        label.draw(window)
    }
)?;

§Main Components

  • app - Application runner and main loops
  • widgets - UI components (labels, panels, containers)
  • color - Color handling and styling
  • input - Keyboard and mouse input
  • render - Low-level rendering and buffers
  • game - Experimental game-oriented utilities (early-stage; API/behavior may change)
  • window - Terminal window management

Check out the examples in the examples/ directory to see MinUI in action. Run them with: cargo run --example basic_usage

Re-exports§

pub use app::App;
pub use app::FrameProfile;
pub use color::Color;
pub use color::ColorPair;
pub use error::Error;
pub use error::Result;
pub use event::Event;
pub use event::KeyKind;
pub use event::KeyModifiers;
pub use event::KeyWithModifiers;
pub use event::MouseButton;
pub use term::ColorSupport;
pub use term::TerminalCapabilities;
pub use text::TabPolicy;
pub use text::byte_index_for_char_index;
pub use text::byte_index_for_grapheme_index;
pub use text::cell_column_for_char_index;
pub use text::cell_column_for_grapheme_index;
pub use text::cell_width;
pub use text::cell_width_char;
pub use text::char_index_from_cell_column;
pub use text::clip_to_cells;
pub use text::clip_to_cells_cow;
pub use text::clip_to_cells_ellipsis;
pub use text::clip_to_cells_into;
pub use text::fit_to_cells;
pub use text::grapheme_count;
pub use text::grapheme_index_from_cell_column;
pub use window::ColoredSpan;
pub use window::TerminalWindow;
pub use window::Window;
pub use input::ClickTracker;
pub use input::CombinedInputHandler;
pub use input::KeybindAction;
pub use input::KeyboardHandler;
pub use input::MouseHandler;
pub use input::ScrollDirection;
pub use input::Scroller;
pub use widgets::Alignment;
pub use widgets::ArrowButton;
pub use widgets::ArrowDirection;
pub use widgets::BorderChars;
pub use widgets::BorderSide;
pub use widgets::Container;
pub use widgets::FocusStyle;
pub use widgets::Gap;
pub use widgets::HoverTracker;
pub use widgets::Label;
pub use widgets::LayoutDirection;
pub use widgets::LinearScrollAccel;
pub use widgets::MacOSScrollAccel;
pub use widgets::ScrollAcceleration;
pub use widgets::ScrollBar;
pub use widgets::ScrollBarOptions;
pub use widgets::ScrollBox;
pub use widgets::ScrollOffset;
pub use widgets::ScrollOrientation;
pub use widgets::ScrollSize;
pub use widgets::ScrollState;
pub use widgets::ScrollUnit;
pub use widgets::Slider;
pub use widgets::SliderOptions;
pub use widgets::SliderOrientation;
pub use widgets::Spinner;
pub use widgets::StatusBar;
pub use widgets::StatusBarPosition;
pub use widgets::StickyEdge;
pub use widgets::Text;
pub use widgets::TextBlock;
pub use widgets::TextWrapMode;
pub use widgets::TitleAlignment;
pub use widgets::Tooltip;
pub use widgets::VerticalAlignment;
pub use widgets::Viewport;
pub use widgets::Widget;
pub use widgets::WidgetArea;
pub use crate::widgets::Table;
pub use crate::widgets::TableColumn;
pub use ui::AutoHide;
pub use ui::HitTestResult;
pub use ui::IdAllocator;
pub use ui::InteractionCache;
pub use ui::InteractionEntry;
pub use ui::InteractionFlags;
pub use ui::InteractionId;
pub use ui::OwnerId;
pub use ui::PolicyEffects;
pub use ui::RouteTarget;
pub use ui::UiScene;

Modules§

app
Simple application runner for handling main loops.
color
Colors and Styling
error
Error Handling
event
Input Events
game
Game Development Tools
input
Input Handling System
macros
Utility Macros
prelude
Common import bundles for MinUI applications.
render
Rendering System
term
Terminal-related utilities.
text
Text utilities for terminal rendering.
ui
UI utilities for MinUI applications.
widgets
Widget System
window
Terminal Window

Macros§

define_colors
Creates multiple ColorPair constants at once.