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.devpackage may lag behind the latest features onmain.
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
BuilableComponentandStatefulComponent. - Cross-platform: supports Linux, macOS, and Windows terminals.
dependencies:
pixel_prompt: ^0.1.3or using pub add
dart pub add pixel_promptdependencies:
pixel_prompt:
git:
url: https://github.com/primequantuM4/pixel_prompt.git
ref: mainThen run:
dart pub getimport '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- Counter App — demonstrates stateful components and buttons.
- Stopwatch App — demonstrates timers and dynamic updates.
- Optimizations and verbosity for layout.
- Additional Components (menus, tables, textfield area).
- Visual Debugger
Contributions are welcome and appreciated!
- Fork the repo and clone it.
- Install dependencies with:
dart pub get- Run tests:
dart test- Open a PR
MIT