termui library

A high-performance terminal UI and windowing system for Dart.

Classes

AbsorbPointer
A widget that absorbs pointer events.
AbsorbPointerElement
Element for AbsorbPointer that handles pointer event absorption.
Align
Undocumented public member.
AlignElement
An element that manages an Align widget.
Alignment
A handle to a location in the widget tree.
Animatable
An interface for widgets that support animation ticks or time-based rendering.
AnimatedButton
A button widget featuring multiple layered custom animation effects.
AnimatedButtonState
The mutable state for AnimatedButton, mixing in the TUI animation ticker capability.
AsyncSnapshot<T>
Immutable representation of the most recent interaction with an asynchronous computation.
Border
Represents the character set and style configuration used to draw a box border.
BoxConstraints
Defines layout boundaries inside terminal cell limits.
BoxDecoration
Defines the visual decoration style (background and borders) for a box.
Buffer
A 2D grid of cell data stored in parallel flat lists.
BufferedTerminalBackend
A terminal backend that maintains a rendering buffer.
BufferWidget
A display widget that paints a Buffer directly onto the parent terminal canvas.
BufferWidgetElement
The element managing layout and painting lifecycle for a BufferWidget.
BuildContext
Undocumented public member.
Builder
A stateless widget that delegates its build method to a callback.
BuildOwner
Undocumented public member.
Button
Undocumented public member.
ButtonState
Undocumented public member.
Canvas
A 2D canvas widget for drawing high-resolution pixel graphics in a terminal.
CanvasElement
Element for high-performance direct flat-buffer rendering in Canvas.
Center
A widget that centers its child within itself.
CharmColors
The official CharmTone color palette from the Charm/Bubble Tea ecosystem.
Checkbox
Undocumented public member.
CheckboxState
Undocumented public member.
ColorMutator
A mathematical mutator for 24-bit TrueColor cells.
Colors
Common standard colors.
Column
Undocumented public member.
ColumnElement
An element that manages a Column widget.
Compositor
Composites multiple layered buffers onto a single target buffer.
ConfirmFormField
A boolean yes/no confirmation prompt field.
ConstrainedBox
Undocumented public member.
ConstrainedBoxElement
An element that manages a ConstrainedBox widget.
Constraint
Abstract base class for all layout constraints.
ControlSequence
Represents a parsed ANSI control sequence from the terminal input.
CursorPositionReportEvent
Event representing cursor position report.
DecoratedBox
A widget that paints a background decoration and border around a child widget.
DecoratedBoxElement
Element for DecoratedBox.
DimmerEffect
Element for EffectWidget that absorbs pointer events. A terminal effect that dims the colors of all cells in its bounds.
DimmingBarrier
A modal barrier that dims the layers behind it.
DiscreteScrollController
A controller for discrete cell-based scroll positions in TUI layouts.
DragDropManager
Global coordinator for handling in-terminal drag and drop sessions.
Draggable<T>
A wrapper widget that makes a child draggable inside a terminal window.
DraggableElement
The element that coordinates and intercepts mouse drag events for Draggable.
DragSession
Represents an active drag session.
DragTarget<T>
A wrapper widget that accepts dropped data from a Draggable.
DragTargetElement<T>
The element that manages the candidate list and lifecycle hooks for DragTarget.
An interactive select menu button that opens a dropdown list overlay.
State for a DropdownButton.
An item in a DropdownButton menu.
Easing
A collection of standard easing functions matching easings.net.
EdgeInsets
An immutable set of offsets in each of the four cardinal directions in terminal space.
EffectWidget
A wrapper widget that applies a TerminalEffect to its descendants post-paint.
EffectWidgetElement
Element for EffectWidget that ignores pointer events.
Element
Undocumented public member.
ElementWidget
An element that manages an InheritedWidget.
ElementWidgetElement
How children are aligned along the cross axis.
Expanded
An Expanded widget forces its child to consume all remaining space in a Row or Column.
FittedBox
A widget that sizes and positions its child within itself according to fit.
FlashEffect
A full-widget background flash pulsation.
FlatNode<T>
Helper info for rendering a flattened tree node.
FlexConstraint
A proportional flexible space constraint.
Flexible
Undocumented public member.
FlexibleElement
An element that manages a Flexible widget.
Focus
A widget that manages a FocusNode to allow keyboard focus tracking and traversal in the widget tree.
Focusable
An interface that indicates a widget or state can receive keyboard focus.
FocusInEvent
Event fired when terminal receives focus.
FocusManager
A node in the keyboard focus tree.
FocusMarker
An InheritedWidget to propagate FocusNode down the BuildContext hierarchy.
FocusNode
A representation of a node in the focus tree.
FocusOutEvent
Event fired when terminal loses focus.
FocusScope
A specialized widget to manage focus navigation traversal.
FocusScopeNode
A specialized focus scope node that manages focus traversal.
FocusScopeState
The state for a FocusScope widget.
FocusState
The state for a Focus widget.
Form
A container widget that coordinates focus, validation, and resets for multiple FormField widgets.
FormField<T>
Abstract base class for all form field widgets in termui.
FormFieldState<T>
Abstract state management class for FormField elements.
FormScope
Ancestor provider to expose form state to field elements.
FormState
The mutable state of a Form.
GlitchEffect
A terminal effect that randomly shifts horizontal character rows within bounds.
GlobalKey<T extends State<StatefulWidget>>
A key that is unique across the entire element tree. Global keys allow widgets to be uniquely identified and retrieved from the registry.
Grid
A widget that renders a static 2D grid of customized GridCells.
GridCell
A cell inside a Grid.
GridElement
Element class that manages layout and paint of Grid.
Help
A widget that formats and displays keybindings, auto-wrapping them to fit.
HelpElement
An element that manages the layout and rendering of a Help widget.
HorizontalRadioGroup
A horizontal group of radio-like choices.
HorizontalRadioGroupState
The state class for HorizontalRadioGroup managing selections and keyboard routing.
InheritedElement
A widget that propagates information down the tree.
InheritedWidget
An element that manages a StatefulWidget and its State.
InkwellButton
A button widget with hover elevation (floating shadow) and pressed radial gradient inkwell ripple animation.
InkwellButtonState
The state for an InkwellButton.
InkwellRippleEffect
A radial expanding ripple effect that radiates from a click coordinate.
InputEvent
Base class for all input events.
Interval<T extends num>
Represents an interval with numeric start and end values.
IntervalNode<T extends num>
Node in the AVL Interval Tree.
IntervalTree<T extends num>
An AVL-based self-balancing Interval Tree.
Key
Undocumented public member.
KeyboardListener
A widget that intercepts keyboard events when it or its children have focus.
KeyEvent
A keyboard event.
KeyEventHandler
An interface that indicates a widget or state can handle terminal keyboard events.
LayeredBuffer
A buffer positioned in a 2D space with a Z-index for layering.
LayoutBuilder
A widget that builds a subtree based on the incoming layout constraints.
LayoutBuilderElement
The element that manages the lifecycle of a LayoutBuilder.
LazyList
A virtual scrolling list widget. Only renders items within the visible viewport.
LazyListElement
Mount element class corresponding to LazyList.
LazyTable
A virtual scrolling table widget. Only requests and renders rows within the viewport.
LazyTableElement
Mount element class corresponding to LazyTable.
LeafElement
Default element for leaf widgets that do not build children.
LeftBorder
A layout widget that draws a vertical line (left border) on the left side of its child.
LeftBorderElement
The Element corresponding to a LeftBorder widget.
LengthConstraint
A fixed length layout constraint.
LinearProgressIndicator
A progress bar widget that fills its horizontal area with block characters.
LinearProgressIndicatorElement
An element that manages the rendering of a LinearProgressIndicator widget.
ListenableSceneRenderer
An interface for SceneRenderers that can notify their manager when they need a visual update.
ListView
A scrollable list of child widgets.
ListViewElement
The element managing a ListView widget.
MinMaxConstraint
A constraint with min and max bounds.
ModalDismissBarrier
A full-screen widget that blocks pointer events and invokes onDismiss when clicked.
ModalDismissBarrierElement
Element managing a ModalDismissBarrier widget.
ModalOverlay
A specialized, high Z-index container that traps focus and intercepts mouse events.
ModalOverlayElement
Element class corresponding to ModalOverlay, managing layout and paint of the modal.
Modifier
Text modifiers represented as a bitmask for performance.
MouseEvent
A mouse event.
MouseEventHandler
An interface that indicates a widget or state can handle terminal mouse events.
MouseEventHandlerWithArea
An interface that indicates a widget or state can handle terminal mouse events with an explicit area boundary.
MultiSelectFormField<T>
A form field representing multiple-option selection from a list of choices.
MultiSelectOption<T>
An option in a multi-selection form field.
NumberSelector
A widget for selecting a numeric value using '<' and '>' buttons.
NumberSelectorElement
An element that manages the rendering and layout of a NumberSelector widget.
Offset
Represents an offset on the terminal cell grid coordinate space.
Overlay
A stack-based layout system that manages overlapping floating widgets.
OverlayEntry
An entry representing a widget that can be inserted into an Overlay.
OverlayState
The state for an Overlay, managing its active entries.
Padding
A widget that wraps another widget and inserts padding around it.
PaddingElement
An element that represents a Padding widget.
Paginator
A pagination dots indicator widget (e.g. ○ ○ ● ○ ○).
PaginatorElement
An element that manages the rendering and layout of a Paginator widget.
PasteEvent
A bracketed paste event.
PathUtils
Utility class for verifying whether paste input represents a potential file path.
PercentageConstraint
A percentage-based layout constraint relative to parent size.
Phase
Represents event phases in the trace log.
PopupMenuButton<T>
A button that displays a pop-up option menu when triggered.
PopupMenuButtonState<T>
State for a PopupMenuButton.
PopupMenuItem<T>
An item in a popup menu.
Positioned
Undocumented public member.
PositionedElement
An element that manages a Positioned widget.
PromptRunner<T>
A helper class to run an interactive terminal prompt inline. It encapsulates the event loop, rendering to an inline buffer, and lifecycle management.
PromptScope
An inherited widget that abstracts prompt completion and lifecycle controls, shielding descendant widgets from any low-level/internal event buses.
Radio<T>
Undocumented public member.
RadioState<T>
Undocumented public member.
Reassemblable
Interface for objects that can be globally reassembled during a hot reload.
Rect
A 2D rectangle representing bounds in terminal space.
RegisteredEffect
An effect registered with its layout bounds and stacking order.
Renderer
A diff-based terminal renderer.
RichText
A widget that displays formatted text using a tree of TextSpan configurations.
RichTextElement
An element that manages a RichText widget.
RingBuffer<T>
A generic fixed-capacity circular ring buffer that maintains the latest capacity elements.
Row
Undocumented public member.
RowElement
An element that manages a Row widget.
SafeLayout
A layout widget that checks constraints and renders a fallback message (or custom fallback widget) if the terminal space is below the minimum required dimensions.
SafeLayoutElement
The element managing the lifecycle, constraints, and painting of SafeLayout.
SceneLayer
Represents a single renderable layer inside a composited terminal scene.
SceneManager
Manages multiple visual layers in a terminal windowing system, handles rendering composition and hardware sync.
SceneRenderer
An interface representing a rendering system in a composited scene.
ScrollBar
An interactive scrollbar widget that reflects and adjusts scrolling state.
ScrollBarElement
Mount element class corresponding to ScrollBar.
SelectFormField<T>
A form field representing single-option selection from a list of choices.
SelectionController<T>
A controller that manages selection state for selection-based widgets.
SelectOption<T>
An option in a selection form field.
SevenSegmentDisplay
A widget that displays a multi-line segmented numerical readout.
SevenSegmentDisplayElement
An element that manages the rendering and layout of a SevenSegmentDisplay widget.
SingleChildElement
An abstract element that manages a widget with at most one child.
SingleChildScrollView
A widget that wraps a single child widget and makes it scrollable.
Size
Undocumented public member.
SizedBox
Undocumented public member.
SizedBoxElement
An element that manages a SizedBox widget.
Slider
A widget for selecting a numeric value by sliding a thumb along a track.
SliderState
The state for a Slider widget.
SparkleEffect
A particle-based sparkle effect that flashes bright icons inside the widget bounds.
Sparkline
A sparkline widget for rendering high-density historical data.
SparklineElement
An element that manages the rendering of a Sparkline.
Spinner
A widget for displaying animated loading/waiting indicators in a TUI.
SpinnerElement
An element that manages the rendering and layout of a Spinner widget.
SplitPane
A widget that divides a viewport into two side-by-side or stacked children.
SplitPaneElement
An element that manages the layout and rendering of a SplitPane widget.
Stack
Undocumented public member.
StackElement
An element that manages a Stack widget.
State<T extends StatefulWidget>
The logic and internal state for a StatefulWidget.
StatefulBuilder
A custom stateful builder widget matching standard Flutter patterns. It allows stateful builders to declare their widget layouts dynamically and obtain local access to setState to trigger rebuilds within inline loops.
StatefulElement
A widget that has mutable state.
StatefulWidget
An element that manages a StatelessWidget.
StatelessElement
A widget that has configuration but delegates rendering to its built child.
StatelessWidget
Instantiated element in the widget tree that keeps track of widget updates and state.
StreamBuilder<T>
Widget that builds itself based on the latest snapshot of interaction with a Stream.
Style
A class representing style attributes for terminal output.
StyledChar
A helper representing a single grapheme cluster with its style.
StyledToken
A helper representing a token (a word, spaces, or a newline) for wrapping.
SubpixelRipple
Represents a single sub-pixel touch/drop ripple animation state.
SubpixelRippleManager
A pure ViewModel/state manager that coordinates multiple expanding sub-pixel Braille touch ripples.
SubpixelRippleWidget
A declarative Widget that embeds and renders ripples managed by a SubpixelRippleManager.
SubpixelRippleWidgetElement
The backing Element for SubpixelRippleWidget that handles layout and paint caching.
Switch
Undocumented public member.
SwitchState
Undocumented public member.
TabBar
A horizontal tab bar widget to select active views from a tab set.
TabBarElement
An element that manages the rendering and layout of a TabBar widget.
TabController
A controller that coordinates the active tab index across TabBar and TabPanel.
Table
A widget for displaying tabular columns of data with optional row selection.
TableElement
Mount element class corresponding to Table, preserving per-cell states.
TabPanel
A container that renders only the widget of the active tab.
TabPanelElement
An element that manages the active panel rendering and layout of a TabPanel widget.
Terminal
The main entry point for interacting with the terminal backend.
TerminalBackend
An abstract base class for native terminal backend implementations.
TerminalEffect
A post-paint mutation applied to the composite terminal buffer.
TerminalStateRequest
A contract defining terminal state requests from a runner or layer.
TermKey
Constants for common key string representations (baseKey and logicalKey). These can be used in switch statements to pattern match on KeyEvent.baseKey or KeyEvent.logicalKey.
TermuiBinding
A global registry of active termui engines (like SceneManager and PromptRunner) that should respond to hot reloads.
Text
A widget that renders styled text with optional wrapping.
TextAreaFormField
A form field wrapping a multi-line text editing area.
TextEditingController
A controller that notifies listeners when editing value changes.
TextEditingValue
Holds the configuration state of a TextField value.
TextElement
An element that represents a Text widget.
TextField
An interactive single-line or multi-line text input field.
TextFieldShortcut
A keyboard shortcut representation for assigning to TextFieldActions.
TextFieldState
The state for a TextField widget.
TextFormField
A form field wrapping a single-line text input field.
TextRun
Represents a styled span of text.
TextSelection
Represents the visual cursor selection offset in terminal cells.
TextSpan
An immutable span of text that can hold styling overrides and nested child spans.
Theme
A widget that propagates a ThemeData down the widget tree.
ThemeData
A class that holds the color and style configurations for a Theme.
TimerWidget
An interactive countdown timer widget.
TimerWidgetElement
An element that manages the rendering and layout of a TimerWidget widget.
Tracer
A high-performance, low-overhead event tracer.
TreeNode<T>
A node in the hierarchical tree structure.
TreeWidget<T>
A tree widget that displays nested TreeNode hierarchies.
TreeWidgetState<T>
The state for a TreeWidget widget.
TuiAnimationConfig
Global configuration for the TUI animation framework.
TuiAnimationEffect
Base abstract class for all terminal user interface (TUI) animation effects.
ValueKey<T>
A concrete subclass of Key for matching widgets by a value.
Viewport
Undocumented public member.
Widget
Undocumented public member.
Window
A Window widget that acts as an isolated floating frame with borders, titles, and local content viewports.
WindowElement
Element class corresponding to Window, managing child reconciliation, layout and paint.

Enums

AnimationStatus
The status of an animation transition.
BlendOption
Options for blending styles in effect helpers.
BoxFit
How a box should be inscribed into another box.
CanvasRenderMode
Defines how pixels are grouped and rasterized.
Clip
Different ways to clip a widget's content.
ConnectionState
The state of connection to an asynchronous computation.
CrossAxisAlignment
Undocumented public member.
CrossAxisFill
How to fill the cross axis for fractional steps.
Direction
Represents a 2D cardinal direction.
ExecutionMode
Defines the execution mode for the PromptRunner.
KeyType
Types of keys that can be pressed.
LayerSizing
Defines sizing policies for layout layers in a compositing scene.
LayoutDirection
Layout direction for box splitting.
MainAxisAlignment
How children are aligned along the main axis.
MouseButton
Mouse buttons.
MouseEventType
Mouse event type.
MousePointer
Represents the mouse pointer shapes supported by compatible terminals via OSC 22.
ProgressBarType
The type of characters used to render the progress bar.
ProgressDirection
The direction the progress bar fills.
PromptExitAction
Defines the state outcome of the PromptRunner when an exit trigger is matched.
PromptExitTrigger
Defines keyboard inputs or signals that can terminate the prompt runner's execution.
RenderingMode
The target mode for terminal rendering.
SliderAxis
The orientation of the slider.
TextAlign
Text alignments for TUI rendering.
TextFieldAction
Actions supported by the TextField widget.
TraceCategory
Categories for surgical profiling of the framework's subsystems.

Mixins

FocusableStateMixin<T extends StatefulWidget>
A mixin that provides focus node management for interactive stateful widgets.
TuiAnimatedStateMixin<T extends StatefulWidget>
Mixin for State objects that allows registration and execution of TUI animations.

Extension Types

Color
Represents a 24-bit RGB color with 8-bit alpha, packed into a single 32-bit integer. Using a single final int field minimizes memory footprint for each Color instance.

Extensions

BufferAnsiSerialization on Buffer
Extensions for serializing Buffer to and from ANSI sequence strings.
ColorIntExtension on int
Extension on int to provide easy access and manipulation of ARGB colors represented as 32-bit integers.
EffectHelpers on Buffer
Helper methods for TerminalEffect implementations.
HitTestExtension on Element
Extension providing recursive spatial hit testing down the mounted Element tree.
PrintWidgetExtension on Terminal
Extension on term.Terminal to print a widget inline using the double-buffered renderer layout.

Constants

kIsWeb → const bool
True if the current application is compiled to run on the web.

Properties

debugLogError ↔ void Function(String message)?
Optional override for error logging (e.g., in test environments).
getter/setter pair
debugMouseCursorEnabled ↔ bool
Render a crosshair over the current mouse position.
getter/setter pair
debugPaintHoverEnabled ↔ bool
Global configuration flags for visual debugging in termui. Highlight the deepest leaf node under the mouse pointer.
getter/setter pair
debugPaintLayerBordersEnabled ↔ bool
Paint borders around all active layers.
getter/setter pair
debugShowTouchesEnabled ↔ bool
Show active touches and expansion rings for visual debugging.
getter/setter pair
debugToggleKey ↔ KeyEvent?
Key sequence to toggle debug overlays globally (if null, hotkey is disabled). Defaults to Ctrl+O to avoid terminal multiplexer conflicts.
getter/setter pair
kIsDebug → bool
True if the application is running in debug mode. Evaluated exactly once at startup.
final

Functions

blendColor(int top, int bottom) → int
Blends two ARGB colors.
getAbsoluteRect(Buffer buffer, Rect localRect) → Rect
Helper function to traverse the parent chain of a Buffer to find its absolute Rect boundaries.
getConstraint(Widget widget, LayoutDirection direction, {int crossSize = 0, Element? element}) → Constraint
Undocumented public member.
graphemeWidth(String grapheme) → int
Returns the physical terminal column width of grapheme (0, 1, or 2).
isWideCodePoint(int codePoint) → bool
Checks if a single code point represents a wide character.
isWideGrapheme(String grapheme) → bool
Returns true if the given grapheme cluster is a double-width (wide) character.
isZeroWidthCodePoint(int codePoint) → bool
Returns true if the given code point occupies 0 terminal cells.
isZeroWidthGrapheme(String grapheme) → bool
Returns true if the grapheme cluster represents a zero-width character (non-spacing marks, format controls, zero-width spaces, or soft hyphens).
logError(String message) → void
Logs an error message. In release mode, this is a no-op. In debug mode, this writes to stderr natively, or uses print() on the web.
measureStringWidth(String text) → int
Measures the physical cell width of a string in a terminal, correctly accounting for CJK and Emoji characters that occupy 2 cells.
padOrTruncate(String text, int width) → String
Pads or truncates a string to match the specified visual column width in a terminal, correctly accounting for wide characters (CJK and Emoji) and utilizing a fast-path for pure ASCII text.
splitRect(Rect area, List<Constraint> constraints, LayoutDirection direction, {MainAxisAlignment mainAxisAlignment = MainAxisAlignment.start}) → List<Rect>
A Viewport wraps a parent buffer, translating and clipping drawing operations to a relative local coordinate space within bounds.

Typedefs

EasingFunction = double Function(double t)
Signature for easing functions that transform linear progress t in [0, 1] into eased progress.
GradientStop = ({Color color, double stop})
A single color stop in a gradient.
LayoutWidgetBuilder = Widget Function(BuildContext context, BoxConstraints constraints)
Signature for the builder callback used by LayoutBuilder.
ProgressColors = ({List<GradientStop>? bg, List<GradientStop>? fg})
A set of foreground and background gradients.
VoidCallback = void Function()
Signature for callbacks that take no arguments and return no data.
WidgetBuilder = Widget Function(BuildContext context)
A function that builds a widget given a build context.

Exceptions / Errors

PromptAbortedException
Base exception thrown when a PromptRunner is aborted via PromptExitAction.abort.
UserInterruptException
Specialized exception for user keyboard interrupts (typically Ctrl+C).