[go: up one dir, main page]

opentui 0.2.0 copy "opentui: ^0.2.0" to clipboard
opentui: ^0.2.0 copied to clipboard

A pure Dart terminal UI engine inspired by OpenTUI.

opentui #

opentui is a pure Dart terminal UI engine inspired by OpenTUI. It includes a node/render engine, renderables, declarative construct helpers, and a CliRenderer wrapper for CLI-focused workflows.

Features #

  • ANSI frame diff rendering with TuiFrame / OptimizedBuffer.
  • Layout engine with row / column / absolute, flexGrow, justify/align, and percent sizing (widthPercent / heightPercent).
  • Focus management and keyboard input with key metadata (name, sequence, meta, option) and paste event support.
  • CliRenderer + createCliRenderer() with:
    • theme mode API (ThemeMode.dark / ThemeMode.light / null)
    • built-in console controller (toggle, position, size, entries, listeners)
  • Core components and renderables:
    • Box, Text, Input, Textarea
    • Select, TabSelect, Slider, Scrollbar, ScrollBox
    • Markdown, Code, Diff, LineNumber
    • ASCIIFont, FrameBuffer
  • Declarative construct helpers from constructs.dart:
    • Box(...), Text(...), Input(...), Markdown(...), etc.

Install #

dart pub add opentui

Documentation #

  • Getting started: ../../docs/getting-started.md
  • Core concepts: ../../docs/core-concepts
  • Components: ../../docs/components

Example #

import 'package:opentui/opentui.dart';

Future<void> main() async {
  final renderer = await createCliRenderer(width: 80, height: 24);

  final app = Box(
    id: 'app',
    layoutDirection: TuiLayoutDirection.column,
    padding: 1,
    children: <BaseRenderable>[
      Text(content: 'OpenTUI Dart'),
      Input(id: 'name', placeholder: 'Type here...'),
      Slider(id: 'volume', width: 20, value: 40),
    ],
  );

  renderer.mount(app.toNode());
  renderer.render();
}
0
likes
140
points
109
downloads

Publisher

unverified uploader

Weekly Downloads

A pure Dart terminal UI engine inspired by OpenTUI.

Repository (GitHub)
View/report issues

Topics

#tui #terminal #cli

Documentation

API reference

License

MIT (license)

Dependencies

meta

More

Packages that depend on opentui