dart_tui library

Elm-style terminal UIs for Dart, inspired by Bubble Tea.

Classes

AdaptiveColor
Adaptive color that selects between light and dark variants based on the terminal background luminance.
BackgroundColorMsg
Background color response message (hex RGB value).
BatchMsg
Internal command message that executes commands concurrently.
BlurMsg
Border
Canvas
A 2-D painting surface for compositing styled text blocks at arbitrary positions with z-index layering.
CanvasView
A Canvas-backed TeaModel-compatible helper that wraps a Canvas in a static (non-interactive) view. Useful for compositing views inside larger layouts.
CapabilityMsg
ClearScreenMsg
Internal request to clear screen on next frame.
ClipboardMsg
Clipboard content read response.
ColorProfileMsg
Color profile update from terminal introspection.
Cursor
CursorColorMsg
Cursor color response message (hex RGB value).
CursorPositionMsg
EdgeInsets
EnvMsg
Environment payload emitted at startup.
ExecMsg
Execute an external process, releasing terminal control around it.
FilePickerModel
Filesystem browser bubble.
FocusMsg
ForegroundColorMsg
Foreground color response message (hex RGB value).
HelpModel
HelpStyles
Style configuration for HelpModel.
InputStyles
Style configuration for TextInputModel and TextAreaModel.
InterruptMsg
Program should stop with interrupted semantics.
KeyBinding
A single bindable key action.
KeyboardEnhancements
KeyboardEnhancementsMsg
Keyboard enhancements negotiation response.
KeyMap
A group of bindings used with HelpModel.fromKeyMap.
KeyMsg
KeyPressMsg
KeyReleaseMsg
ListStyles
Style configuration for SelectListModel.
Model
Elm-style model: init, update, view.
ModeReportMsg
Mouse
MouseClickMsg
MouseMotionMsg
MouseMsg
MouseReleaseMsg
MouseWheelMsg
Msg
Terminal events and application messages (Bubble Tea style).
OutcomeModel<T>
Optional model mixin used by prompt-style flows that return a value.
PaginatorModel
PasteEndMsg
PasteMsg
Bracketed paste text payload.
PasteStartMsg
PrintLineMsg
Program
ProgramOptions
Compatibility options while migrating toward option-function API.
ProgressBar
ProgressModel
Simple determinate progress bar (0.0–1.0).
ProgressStyles
Style configuration for ProgressModel.
QuitMsg
Program should stop gracefully.
RawMsg
Raw sequence send message.
ReadClipboardMsg
ReadPrimaryClipboardMsg
RequestBackgroundColorMsg
RequestCapabilityMsg
RequestCursorColorMsg
RequestCursorPositionMsg
RequestForegroundColorMsg
RequestTerminalVersionMsg
RequestWindowSizeMsg
ResumeMsg
Program resumed from suspend.
RgbColor
SelectListModel
Vertical list with a cursor (arrow keys). Reusable building block.
SequenceMsg
Internal command message that executes commands in-order.
SetClipboardMsg
SetPrimaryClipboardMsg
SpinnerModel
Indeterminate spinner driven by TickMsg.
SpinnerStyles
Style configuration for SpinnerModel.
StopwatchModel
Elapsed-time stopwatch bubble. Driven by TickMsg.
Style
Composable ANSI style object inspired by Lip Gloss primitives.
SuspendMsg
Program should suspend.
TableColumn
A column definition for TableModel.
TableModel
Tabular data viewer with keyboard navigation.
TableStyles
Style configuration for TableModel.
TeaKey
Logical key.
TerminalVersionMsg
TextAreaModel
Multi-line text editor bubble.
TextInputModel
Single-line text field with full Bubbletea-compatible feature set.
Theme
A named collection of Style presets for common semantic roles.
TickMsg
Tick signal for timers/animation.
TimerModel
Countdown timer bubble. Driven by TickMsg (optionally filtered by id).
TreeModel
Hierarchical tree viewer with keyboard-driven expand/collapse.
TreeNode
A node in a TreeModel.
TreeStyles
Style configuration for TreeModel.
TuiStyle
Minimal compatibility ANSI helpers.
ValidationFailedMsg
Emitted when TextInput validation fails.
View
Declarative terminal view.
ViewportModel
Scrollable content pane.
WindowSizeMsg
Window resize event.

Enums

Align
Horizontal text alignment.
AlignVertical
Vertical content alignment (used when Style.height is set).
ColorProfile
CursorShape
EchoMode
How the text input renders its value.
KeyCode
KeyMod
Keyboard modifiers.
MouseButton
MouseMode
ProgressBarState

Constants

kittyReportEventTypes → const int

Functions

batch(List<Cmd?> cmds) Cmd?
Run several commands concurrently.
blend(RgbColor a, RgbColor b, double t) RgbColor
Linearly interpolate between a and b by t (0.0 = all a, 1.0 = all b).
clearScreen() Msg
darken(RgbColor c, double amount) RgbColor
Darken c by amount (0.0–1.0): blend toward black.
every(Duration d, Msg fn(DateTime t)) Cmd
Tick aligned to wall clock boundary.
execProcess(String executable, List<String> arguments, {Map<String, String>? environment, bool inheritStdio = true, Msg? onExit(int exitCode)?}) Cmd
Execute an external process, releasing terminal control around it.
gradientBackground(String text, List<RgbColor> colors, {Style? foreground}) String
Render text with a per-character horizontal background color gradient.
gradientText(String text, List<RgbColor> colors) String
Render text with a per-character horizontal foreground color gradient smoothly blended across colors.
interrupt() Msg
isDarkRgb(int rgb) bool
Returns true if the packed RGB integer rgb (as returned by BackgroundColorMsg.rgb) represents a dark background.
joinHorizontal(double alignment, List<String> blocks) String
Join styled blocks side-by-side (horizontal composition).
joinVertical(double alignment, List<String> blocks) String
Join blocks vertically (stacked), padding narrower blocks to widest width.
lighten(RgbColor c, double amount) RgbColor
Lighten c by amount (0.0–1.0): blend toward white.
newView(String s) View
place(int width, int height, double hAlign, double vAlign, String content) String
Place content within a box of width x height.
placeHorizontal(int width, double align, String content) String
Center content horizontally within width columns.
placeVertical(int height, double align, String content) String
Place content vertically within height rows.
printf(String template, [List<Object?> args = const []]) Cmd
println([Object? value]) Cmd
promptConfirm(String question, {ProgramOptions options = const ProgramOptions()}) Future<bool?>
Yes / no; returns null on cancel.
promptInput(String label, {ProgramOptions options = const ProgramOptions()}) Future<String?>
Single-line text; returns null on cancel.
promptSelect(List<String> choices, {ProgramOptions options = const ProgramOptions(), String title = 'Choose one'}) Future<String?>
Prompt helpers built on Program + OutcomeModel (optional sugar). Single-choice list; returns the selected string, or null if cancelled.
quit() Msg
raw(Object value) Cmd
readClipboard() Msg
readPrimaryClipboard() Msg
requestBackgroundColor() Msg
requestCapability(String name) Cmd
requestCursorColor() Msg
requestCursorPosition() Msg
requestForegroundColor() Msg
requestTerminalVersion() Msg
requestWindowSize() Msg
sequence(List<Cmd?> cmds) Cmd?
Run commands in order.
setClipboard(String s) Cmd
setPrimaryClipboard(String s) Cmd
suspend() Msg
tick(Duration d, Msg fn(DateTime t)) Cmd
Delay before delivering a time-based message.
tickWithId(Duration d, Object id) Cmd
Tick with an ID for routing to specific timer/stopwatch models.
withCellRenderer() ProgramOption
withColorProfile(ColorProfile profile) ProgramOption
withContext(Future<void> cancellation()) ProgramOption
withEnvironment(Map<String, String> env) ProgramOption
withFilter(Msg? filter(Model model, Msg msg)) ProgramOption
withFps(int fps) ProgramOption
withInput(Stream<List<int>>? input) ProgramOption
withoutCatchPanics() ProgramOption
withOutput(IOSink output) ProgramOption
withoutRenderer() ProgramOption
withoutSignalHandler() ProgramOption
withWindowSize(int width, int height) ProgramOption

Typedefs

Cmd = FutureOr<Msg?> Function()
Async side-effect that eventually yields a Msg (Bubble Tea Cmd).
HelpEntry = ({String description, String key})
LegacyKeyMsg = KeyPressMsg
Legacy alias retained for compatibility.
ProgramOption = void Function(Program program)
TableStyleFunc = Style? Function(int row, int col)
Per-cell style callback. row is the 0-based data row index (not counting the header). col is the 0-based column index. Return the Style to apply to that cell's text, or null to use the default row style.
TeaModel = Model
Backwards-compatible alias for previous API name.