Expand description
Widget System: Composable UI components for terminal applications.
This module provides a collection of widgets that implement the Widget trait,
allowing them to be composed into complex layouts and rendered to the terminal.
§Available Widgets
StreamWidget- Scrolling text viewport for streaming content (LLM output)TextInput- Single-line text input with cursorStatusBar- Three-section status bar (left, center, right)ProgressBar- Horizontal progress indicator
§Widget Trait
All widgets implement the Widget trait, which provides:
bounds()/set_bounds()- Layout managementrender(&mut Buffer)- Draw to the bufferhandle_input(&InputEvent) -> bool- Input handlingneeds_redraw()/clear_redraw()- Dirty tracking
§Example
ⓘ
use flywheel::widget::{Widget, TextInput, StatusBar};
use flywheel::Rect;
let mut input = TextInput::new(Rect::new(0, 23, 80, 1));
let mut status = StatusBar::new(Rect::new(0, 0, 80, 1));
status.set_all("Flywheel", "v0.1.0", "60 FPS");
input.set_content("Hello, world!");
// Render both widgets
input.render(buffer);
status.render(buffer);Structs§
- Progress
Bar - A horizontal progress bar widget.
- Progress
BarConfig - Configuration for the progress bar widget.
- Scroll
Buffer - Ring buffer for storing lines with scrollback.
- Status
Bar - A three-section status bar (left, center, right).
- Status
BarConfig - Configuration for the status bar widget.
- Stream
Config - Configuration for the stream widget.
- Stream
Widget - A streaming text widget optimized for LLM token output.
- Terminal
- A terminal emulator widget.
- Text
Input - A single-line text input widget with cursor and editing support.
- Text
Input Config - Configuration for the text input widget.
Enums§
- Append
Result - Result of an append operation.
- Progress
Style - Visual style for the progress bar.
Traits§
- Widget
- A UI component that can be rendered to a buffer and handle input.