🦀 Feather-Tui
A Rust rewrite of the terminal UI library I originally wrote in C for my school management project.
⚠️ This is my first-ever Rust project ⚠️
Termui is a simple terminal UI library designed to provide building blocks for text-based user interfaces. It started life as a small C library in my school management system project, aiming to offer an easy-to-use UI framework for terminal applications. Now, I’m rewriting it in Rust to learn the language and (hopefully) improve both performance and maintainability.
📊 Progress
- 🚧 Termui is still under development.
- ✅ Some parts are complete, while others are only partially done.
- ✨ These parts may get refined or improved in the future.
- 👍 For now, they’re good enough to work with.
📦 Crates
Comming Soon
🚀 Usage
Here’s a step-by-step example demonstrating how to create a basic terminal UI using Termui in it current state.
1️⃣ Import Termui
// Import your termui module
use termui as tui; // Use a shorter alias for convenience
2️⃣ Create Components
let header = new;
let option = new;
let text = new;
This creates 3 components:
| Component | Description |
|---|---|
| ✨ Header | Displays a title at the top. |
| 🛠️ Option | Represent selectable options. |
| 📝 Text | Displays regular text content. |
3️⃣ Make A Container
let mut container = new;
container.set_header;
container.add_option;
container.add_text;
The container holds and organizes all components, so the renderer can process them as a single unit.
4️⃣ Create a Renderer
let mut renderer = new;
This sets up the renderer, which controls the drawing area (20 columns wide, 10 rows high in this case).
5️⃣ Ready The Renderer
ready;
This prepares the terminal for drawing (like switching into a special "UI mode").
6️⃣ Render and Draw
renderer.render;
renderer.draw;
This tells the renderer to process the container and its components, then draw everything onto the screen.
7️⃣ Delay And Exit
sleep;
unready;
Without delaying, the program would quit instantly, so this gives you time to see the UI.
Unreadying the renderer restores the terminal back to its normal state (important to avoid terminal glitches after quitting).
🏗️ Dependencies
bitflags crossterm