pixel_prompt 0.1.3
pixel_prompt: ^0.1.3 copied to clipboard
A fast, extensible terminal UI (TUI) framework for Dart with a custom renderer, component tree layout, and support for interactive apps.
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