modalx
A responsive, declarative, box-encapsulated Terminal User Interface (TUI) and modal dialog engine for Rust, built directly on crossterm.
╭──────────────────────────────────────────────────────────────────────────────╮
│ WORKSPACE & PIPELINE CONTROLLER │
├──────────────────────────────────────────────────────────────────────────────┤
│ Project: nexus-core | Branch: feat/async-worker | Target: x86_64-musl │
│ Environment: Staging | Health: Nominal (99.9%) | Active Workers: 8 │
├──────────────────────────────────────────────────────────────────────────────┤
│ > [1] Run Build & Verification Pipeline │
│ [2] Interactive Test Suite (51 passed) │
│ [3] Database Schema Migrations │
│ [4] Deploy Staging Canary Artifact │
│ [5] Inspect Telemetry & Real-Time Logs │
│ [6] Workspace Configuration & Secrets │
├──────────────────────────────────────────────────────────────────────────────┤
│ [↑/↓/j/k] Navigate | [Enter] Execute | [Esc] Back | [q] Quit │
╰──────────────────────────────────────────────────────────────────────────────╯
Core Capabilities
- Strict Unicode Box Encapsulation: All visual content is strictly contained within Unicode borders (
╭─╮,│ │,├─┤,╰─╯) with automatic ASCII fallback. Boundaries never clip, overflow, or break terminal line layouts. - Responsive Terminal Protection: Detects constrained viewports (< 60 columns x 14 rows), pauses execution with a centered warning card, and automatically resumes on resize.
- Dynamic Greedy Reflow: Delimited metadata tokens (e.g.
Branch: main | Target: Release | Status: Ready) dynamically wrap across multiple framed lines rather than truncating with ellipses. - Full Modal Library:
SelectModal: Searchable, paginated keyboard-driven menus with hotkeys and vim navigation.FormModal: Multi-field forms with real-time validators, keystroke force-validators, masked password fields, integer/numeric constraints, and unsaved changes confirmation.InputModal: Readline text editing with word jump, character deletion, password masking, and custom validation.ConfirmModal: Affirmative/negative prompts with horizontal centering, default focus control, and danger mode styling.InfoModal: Multi-line scrollable dialogs with contextual shortcut bars that omit scroll hints when content fits the viewport.TableModal: Multi-column tabular data displays with column alignment (Left, Center, Right) and row selection.WaitingModal: In-place progress monitors with smooth animated braille spinners and multi-step checklists.
- Dynamic Shortcuts Engine: Contextual shortcut bar (
Shortcuts,ShortcutBar) with automatic deduction and formatted bracketed key hints. - RAII Terminal Safety: Process-wide panic hook ensuring raw mode is disabled and cursor visibility is restored on unexpected exits.
Installation
Add modalx to your Cargo.toml:
[]
= "0.1"
Or install via Cargo CLI:
Or run the quickstart script:
|
Quickstart
1. Interactive Command Center (SelectModal)
use *;
2. Multi-Field Form with Validation (FormModal)
use *;
3. Production Deployment Confirmation (ConfirmModal)
use *;
4. Tabular Data Browser (TableModal)
use *;
5. Multi-Step Task Monitor (WaitingModal)
use *;
Examples
Run any of the included examples:
# Minimal menu selection
# Responsive dashboard with metadata reflow
# Multi-step wizard chaining inputs, menus, and confirms
# Structured data table viewer
# Multi-step animated progress spinner
Documentation
Comprehensive documentation, architecture guides, and cookbooks are available on the official documentation site:
- Documentation: modalx.oguzhanumutlu.com
- API Reference: docs.rs/modalx
License
MIT (c) Oguzhan Umutlu