PixelPrompt
PixelPrompt is a Terminal UI (TUI) framework for Dart, inspired by Flutter’s widget-driven architecture.
It brings Dart’s familiar, declarative UI style to the command line, letting you build interactive, styled terminal applications with layouts, stateful components, and keyboard/mouse events.
Note:
The API is experimental and may break between versions.
Thepub.dev
package may lag behind the latest features onmain
.
Why PixelPrompt?
Dart has proven itself in the GUI world (via Flutter), but building TUIs often requires low-level terminal handling or foreign libraries.
PixelPrompt bridges that gap by offering:
- A component-based architecture (similar to Flutter widgets).
- Built-in layouts, stateful components, keyboard & mouse input.
- Customizable styling (colors, padding, margin, borders).
- Extensible API via
BuilableComponent
andStatefulComponent
. - Cross-platform: supports Linux, macOS, and Windows terminals.
Installation
From pub.dev
(may lag behind main
):
dependencies:
pixel_prompt: ^0.1.3
or using pub add
dart pub add pixel_prompt
From GitHub (latest, potentially unstable):
dependencies:
pixel_prompt:
git:
url: https://github.com/primequantuM4/pixel_prompt.git
ref: main
Then run:
dart pub get
Quick Start - Hello World
import 'package:pixel_prompt/pixel_prompt.dart';
void main() {
App(
children: [
TextComponent(
"Hello, PixelPrompt!",
// style is optional
style: TextComponentStyle(
// foreground color for the text
color: ColorRGB(200, 200, 200),
// background color for the text
bgColor: ColorRGB(30, 30, 30),
padding: EdgeInsets.symmetric(horizontal: 2, vertical: 1),
),
),
],
).run();
}
Run it:
dart run hello_world.dart
Examples
- Counter App — demonstrates stateful components and buttons.
- Stopwatch App — demonstrates timers and dynamic updates.
Roadmap
- Optimizations and verbosity for layout.
- Additional Components (menus, tables, textfield area).
- Visual Debugger
Contributing
Contributions are welcome and appreciated!
- Fork the repo and clone it.
- Install dependencies with:
dart pub get
- Run tests:
dart test
- Open a PR
License
MIT
Libraries
- common/response_input
- components/border_style
- components/checkbox
- components/checkbox_list
- components/colors
- components/column
- components/font_style
- components/row
- components/text_component
- components/text_component_style
- components/text_field_component
- core/app
- core/axis
- core/buffer_cell
- core/buildable_component
- core/canvas_buffer
- core/component
- core/component_instance
- core/component_state
- core/context
- core/edge_insets
- core/interactable_component_instance
- core/interactable_registry
- core/parent_component_instance
- core/position
- core/rect
- core/size
- core/stateful_component
- events/input_event
- handler/input_handler
- layout_engine/layout_engine
- layout_engine/positioned_component
- logger/logger
- manager/command_mode_handler
- manager/component_input_handler
- manager/focus_manager
- manager/input_dispatcher
- manager/input_manager
- manager/input_registry
- pixel_prompt
- renderer/border_renderer
- renderer/render_manager
- terminal/terminal_functions
- terminal/terminal_interpreter