noir library

Noir — high-level widget and application API.

This barrel exposes the public surface needed to build TUI apps with the Flutter-like widget framework. For renderer/buffer primitives, custom render-object adapters, or advanced hosting and coordination through TuiBinding, RenderObject, and BuildOwner, see package:noir/noir_low_level.dart. Concrete Element types remain framework-owned and are not part of either barrel.

For raw FFI (ABI-unstable), see package:noir/noir_ffi.dart.

import 'package:noir/noir.dart';

Classes

Action<T extends Intent>
Handles semantic intents.
Actions
Inherited map from intent type to Action.
ActivateIntent
Activates the currently focused control.
Align
A widget that aligns its child within itself.
Alignment
An alignment within a rectangle, expressed as fractional coordinates in [-1, 1] on each axis. (-1, -1) is the top-left corner, (0, 0) is the center, (1, 1) is the bottom-right corner.
Animation<T>
A value that changes over time, notifying value and status listeners.
AnimationController
Drives a value between lowerBound and upperBound on ticks from vsync.
AsciiFont
Paints text using Noir's built-in multi-row terminal alphabet.
Attr
Terminal cell attribute bit flags.
Autocomplete<T>
A controlled text field with an attached suggestion presentation.
Badge
A short, bold, filled tag that labels the state of something near it.
Border
A border drawn around a rectangular region of a terminal.
BorderSides
Selects which sides of a terminal box are drawn.
BoxBorder
Base class for box borders (like Border).
BoxConstraints
Box-shaped layout constraints with independent min/max on each axis.
BoxDecoration
An immutable description of how to paint a box.
BoxOptions
Semantic options for drawing a terminal box.
BuildContext
A widget's location in the element tree, exposing inherited and ancestor lookups.
Button
A labelled push surface activated by Space, Enter, or a left click.
CallbackAction<T extends Intent>
Action backed by a Dart callback.
ChangeNotifier
Default Listenable implementation backed by a listener list.
CharacterActivator
Matches a printable character plus optional exact modifiers.
Checkbox
A two-state box with an optional label, toggled by Space, Enter, or a click.
CodeHighlighter
Converts source code to non-overlapping UTF-16 style ranges.
CodeView
Scrollable, selectable source-code viewer with async-safe highlighting.
Color
Immutable RGBA color stored as normalized (0–1) channel values.
Column
A widget that displays its children in a vertical array.
ConstrainedBox
A widget that imposes additional constraints on its child.
Constraints
Layout constraints handed down from a parent to a child during the constraint-down / size-up layout pass.
Container
A convenience widget that combines common painting, positioning, and sizing widgets.
DataColumn
One column of a DataTable.
DataTable
A scrolling table of rows and columns with an aligned header.
DecoratedBox
A widget that paints a Decoration either before or after its child paints.
Decoration
A description of a box decoration (a decoration applied to a Rect).
DeleteBackwardIntent
Deletes the character before the cursor.
DeleteForwardIntent
Deletes the character after the cursor.
DiffDocument
Immutable collection of files parsed from one patch.
DiffFile
Immutable file in a parsed diff document.
DiffHunk
Immutable unified-diff hunk.
DiffLine
Immutable line in a parsed diff hunk.
DiffView
Scrollable unified or aligned split diff presentation.
DiffViewController
Imperative hunk navigation for DiffView.
DismissIntent
Dismisses the current interaction.
Disposable
Interface for objects that release resources explicitly.
Divider
A filled rule that separates sections of a layout.
EdgeInsets
Insets from each edge of a rectangle, in terminal character cells.
Expanded
A Flexible that forces its child to fill the available main-axis space.
Flex
Base class for widgets that arrange children in a one-dimensional array.
Flexible
A widget that gives its child a share of the main-axis space in a Flex.
Focus
Attaches a FocusNode here and rebuilds when its focus state changes.
FocusNode
A focusable point in the focus tree that notifies listeners when its focus state changes.
FocusScope
A Focus whose FocusScopeNode groups descendant focus and remembers its focused child.
FocusScopeNode
A FocusNode that records its focusedChild and owns a traversal policy for its subtree.
FocusTraversalPolicy
Determines how focus moves through a FocusScopeNode.
GlobalKey<T extends State<StatefulWidget>>
An owner-wide unique lookup handle for an Element.
Icons
Named glyphs for marks, carets, arrows, shapes, keys, and status markers.
Image
Displays a decoded image through terminal-native protocols or block cells.
InheritedWidget
Base class for widgets that efficiently propagate information down the tree.
InlineSpan
Base class for inline text content.
InsertTabIntent
Inserts a tab/indentation into an editable control.
InsertTextIntent
Inserts text into an editable control.
Intent
Base class for semantic input commands.
Key
Identity token that reconciliation compares to preserve widget state across rebuilds.
KeyEvent
Keyboard input event delivered to registered KeyEventHandler listeners.
KeyModifiers
Keyboard modifier bitmask constants for use with KeyEvent.modifiers.
KittyFlags
Kitty keyboard protocol enhancement flags for use with KeyboardSupport.enableKittyKeyboard.
LayoutBuilder
Builds its child from the BoxConstraints its parent offers.
Listenable
Object that can notify listeners when its observable state changes.
ListView
A vertically scrolling list that builds only the rows currently on screen.
LocalKey
A Key compared only among siblings under the same parent.
LogicalKeyboardKey
Logical keyboard key identity independent of the raw terminal sequence.
MarkdownThemeData
Immutable style palette for MarkdownView.
MarkdownView
GitHub-flavoured Markdown document.
Shows menuChildren on the package-owned root overlay, anchored to the launcher.
Opens and closes a single MenuAnchor.
Hosts an unstyled modal behavior boundary above child.
ModalController
Opens and closes exactly one attached Modal.
MouseEvent
Mouse input event delivered to registered MouseEventHandler listeners.
MouseScroll
Immutable wheel direction and positive tick magnitude.
MoveCaretDocumentEndIntent
Moves the caret to the document end.
MoveCaretDocumentStartIntent
Moves the caret to the document start.
MoveCaretDownIntent
Moves the caret down.
MoveCaretLeftIntent
Moves the caret left.
MoveCaretLineEndIntent
Moves the caret to the current line end.
MoveCaretLineStartIntent
Moves the caret to the current line start.
MoveCaretRightIntent
Moves the caret right.
MoveCaretUpIntent
Moves the caret up.
MoveSelectionDownIntent
Moves a selection one item down.
MoveSelectionFirstIntent
Moves a selection to the first item.
MoveSelectionLastIntent
Moves a selection to the last item.
MoveSelectionPageDownIntent
Moves a selection by one page down.
MoveSelectionPageUpIntent
Moves a selection by one page up.
MoveSelectionUpIntent
Moves a selection one item up.
NextFocusIntent
Moves focus to the next focusable node.
ObjectKey<T>
A LocalKey that matches only when value is the identical object.
Offset
A 2D offset in terminal character cells (integer-positioned).
OverlayPortal
Keeps child in the ordinary tree and hosts overlayChildBuilder on the package-owned root overlay without changing logical ancestry.
OverlayPortalController
Shows and hides the overlay child of a single OverlayPortal.
Padding
A widget that insets its child by the given padding.
Panel
A themed bordered region with an optional title on its top edge.
PasteEvent
A bracketed-paste block delivered as a single event instead of one synthetic key event per character. Subscribe via InputManager.onPaste.
PlainTextCodeHighlighter
Highlighter that intentionally leaves source text unstyled.
PointerListener
Invokes mouse callbacks for events hit-tested within child's bounds.
Positioned
Positions one child relative to the edges of its nearest Stack.
PreviousFocusIntent
Moves focus to the previous focusable node.
ProgressBar
A one-row bar showing a fraction of completed work.
ProxyWidget
A widget that proxies its configuration to a single child.
Rect
An axis-aligned rectangle in terminal character cells (integer positioned).
RichText
Displays an InlineSpan tree.
Row
A widget that displays its children in a horizontal array.
ScrollBox
A scrollable container, parity with OpenTUI-React <scrollbox>.
ScrollController
Observable scroll state shared between ScrollBox and its consumers.
ScrollDownIntent
Scrolls down.
ScrollLeftIntent
Scrolls left.
ScrollPageDownIntent
Scrolls one page down.
ScrollPageUpIntent
Scrolls one page up.
ScrollRightIntent
Scrolls right.
ScrollToEndIntent
Scrolls to the end.
ScrollToStartIntent
Scrolls to the beginning.
ScrollUpIntent
Scrolls up.
Select<T>
A scrollable list-of-options selector, parity with OpenTUI-React <select>.
SelectedText
Immutable selection payload reported by selectable document widgets.
SelectOption<T>
A single option in a Select list.
ShortcutActivator
Matches a KeyEvent and chooses a semantic Intent.
Shortcuts
Inherited map from keyboard activators to semantic intents.
SingleActivator
Matches a logical key plus optional exact modifiers.
Size
A 2D size in terminal character cells.
SizedBox
A box with a fixed width and/or height that constrains its child.
Slider
A controlled horizontal or vertical value slider.
Spinner
A one-cell animated glyph that reports ongoing work.
SpinnerFrames
Ready-made frame sequences for Spinner.
Stack
Overlays children in document order.
State<T extends StatefulWidget>
Mutable state for a StatefulWidget.
StatefulWidget
A widget that has mutable state managed by a State object.
StatelessWidget
A widget that describes its UI by building other widgets.
StyledTextRange
One non-overlapping UTF-16 style range returned by a CodeHighlighter.
SubmitTextIntent
Submits an editable control.
Switch
A two-state toggle with an optional label, flipped by Space, Enter, or a click.
TabSelect<T>
A horizontal, focusable selector over typed SelectOption values.
TerminalImage
An explicitly owned decoded image backed by OpenTUI.
TerminalImageInfo
Immutable decoded-image metadata.
Text
A run of text with a single style, rendered through the terminal text pipeline.
TextArea
Multi-line text input, parity with OpenTUI-React <textarea>.
TextDecoration
A linear decoration to draw near the text.
TextEditingController
Controls editable text through an immutable TextEditingValue.
TextEditingValue
Immutable text editing state: text, selection, and composing range.
TextHighlight
Configuration for highlighting a range of text within a RenderParagraph.
TextIndexMap
Maps between UTF-16 code-unit offsets and grapheme indices for a single immutable text snapshot.
TextInput
A text input widget with cursor support.
TextInputConnection
Applies text-editing shortcuts and intents to a TextEditingController.
TextLayout
A laid-out text snapshot.
TextLayoutLine
One laid-out terminal text line.
TextLayoutRun
One styled run within a laid-out text line.
TextRange
A range of text represented with UTF-16 offsets.
TextSelection
A text selection represented with base and extent UTF-16 offsets.
TextSpan
A text span with optional children.
TextStyle
An immutable style describing how to format and paint text.
TextStyles
Pre-defined text styles for common use cases
TextTable
A finite rich-text table with synchronized row layout and grid selection.
Theme
Publishes a ThemeData palette to every widget below it.
ThemeData
The color tokens Noir's built-in widgets resolve against.
Ticker
Invokes its callback each frame while active with the elapsed time since start.
TickerProvider
Interface for objects that vend Tickers driven by the frame scheduler.
TreeNode<T>
One immutable value in a TreeView hierarchy.
TreeView<T>
A virtualized, keyboard- and pointer-navigable tree.
TreeViewController<T>
Owns generic expansion and selection state for a TreeView.
TuiApp
Owns one mounted terminal application and its app-level input handlers.
TuiCanvas
The supported terminal paint vocabulary.
UnifiedDiffParser
Parses standard and Git-flavoured unified patch text.
UniqueKey
A LocalKey equal only to its own instance, never to another key.
ValueKey<T>
A LocalKey that matches another ValueKey of the same type holding an equal value.
ValueListenable<T>
A Listenable that exposes a current value.
ValueNotifier<T>
A ChangeNotifier that publishes one value.
ViewportController
Shared integer viewport math — offset clamping, paging, and ensure-visible logic — with a single owner so subtle off-by-ones don't drift between widgets. Its consumers are Select, TextArea, and the patch-manager view; ScrollBox owns a separate double-precision scroll model (ScrollController).
Widget
Immutable description of part of the user interface.
Wrap
Arranges children into horizontal or vertical runs.

Enums

AnimationStatus
Direction or terminal state reported by Animation.status.
AsciiFontFamily
Seven Noir-designed treatments of the built-in 5x7 display alphabet.
AutocompleteStatus
Presentation supplied to a controlled Autocomplete.
Axis
The direction of a one-dimensional layout or viewport.
BadgeVariant
Meanings a Badge can carry, each mapping to one ThemeData status token.
BorderStyle
The style of line to draw for a Border.
BoxShape
The shape used when rendering a BoxDecoration.
CrossAxisAlignment
How the children should be placed along the cross axis in a flex layout.
CursorStyle
Cursor styles supported by terminals
DecorationPosition
Where to paint a box decoration.
DiffLineKind
Semantic kind of one unified-diff line.
DiffViewMode
Presentation mode for DiffView.
FlexFit
How a flexible child is allowed to size itself along the main axis.
FontStyle
Whether to slant the glyphs in the font.
FontWeight
The thickness of the glyphs used to draw text.
ImageColorStatus
Color-profile interpretation reported by OpenTUI.
ImageFit
How an image is mapped into its terminal-cell box.
ImageFormat
Encoded or raw format reported by OpenTUI.
ImageLoadErrorCode
Stable image-source loading failure categories.
ImageProtocol
Terminal image transport requested for a draw operation.
KeyEventResult
Result returned by key-event handlers in the focus/shortcut pipeline.
MainAxisAlignment
How the children should be placed along the main axis in a flex layout.
MainAxisSize
How much space should be occupied in the main axis.
MouseButton
Mouse buttons distinguished by the terminal.
MouseCursor
Mouse pointer shapes requested from terminals supporting OSC 22.
MouseEventType
Kinds of mouse interaction reported by the terminal.
MouseScrollDirection
Direction reported by a terminal wheel event.
StackFit
How non-positioned children are constrained by a RenderStack.
TerminalImageErrorCode
Stable native image failure categories.
TextAffinity
Directional preference for a collapsed text selection at a line break.
TextAlign
How terminal text should be aligned horizontally.
TextEffect
Terminal-specific text effects not available in Flutter.
TextOverflow
Overflow behaviour for terminal text rendering.
TextTableColumnFitter
How bounded content cells are distributed across columns.
TextTableColumnWidthMode
How a table chooses its total width.
TextTableWrapMode
Cell wrapping policy for TextTable.
WrapAlignment
Main-axis or run-axis distribution used by RenderWrap.
WrapCrossAlignment
Cross-axis placement of children within one run.

Mixins

SingleTickerProviderStateMixin<T extends StatefulWidget>
Lets a State vend exactly one ticker, disposed with the state.
TickerProviderStateMixin<T extends StatefulWidget>
Lets a State vend any number of tickers, disposing the survivors with the state.

Functions

cellToGraphemeIndex(String text, int cell) int
Inverse of graphemeIndexToCell: given a column offset in cells, return the grapheme index that starts at or just before that column. Used by click-to-cursor mapping.
graphemeIndexToCell(String text, int index) int
Cell-column position of grapheme index within text (assuming text is laid out left-to-right with each cluster taking terminalCellWidth cells). Equivalent to terminalStringWidth(text up to grapheme #index).
registerHotReloadExtension(TuiApp app) → void
Lets a hot-reload driver rebuild app over the VM service.
runTuiApp(Widget app, {bool headless = false, bool enableMouse = false}) TuiApp
Mounts app and returns its owning application lifecycle facade.
sliceByCells(String text, int maxCells) String
Slice text to fit within maxCells terminal cells starting from the beginning, respecting grapheme cluster boundaries. A wide cluster that would push the result past maxCells is dropped entirely (we never paint a "half" wide cluster).
terminalCellWidth(String cluster) int
Returns the terminal cell width of a single grapheme cluster.
terminalStringWidth(String text) int
Returns the terminal cell width of text by summing the width of each grapheme cluster.

Typedefs

ActionCallback<T extends Intent> = KeyEventResult Function(T intent, BuildContext context)
Function used by CallbackAction.
AnimationStatusListener = void Function(AnimationStatus status)
Signature of callbacks notified when an animation's status changes.
AutocompleteOptionBuilder<T> = Widget Function(BuildContext context, T option, bool highlighted)
Builds one option in an Autocomplete suggestion list.
DataTableCellBuilder = Widget Function(BuildContext context, int row, int column)
Signature for building the cell at row and column of a DataTable.
DataTableSort = void Function(int columnIndex, bool ascending)
Signature for a sort request raised by clicking a sortable column header.
DiffHunkCallback = void Function(DiffFile file, DiffHunk hunk)
Called for an activated hunk heading.
DiffLineCallback = void Function(DiffFile file, DiffHunk hunk, DiffLine line)
Called for an activated diff line.
DiffRowBuilder = Widget Function(BuildContext context, DiffFile file, DiffHunk hunk, DiffLine? line, Widget defaultRow)
Builds a custom row from the semantic diff row and Noir's default row.
FocusOnKeyEvent = KeyEventResult Function(FocusNode node, KeyEvent event)
Handles a key event at FocusNode scope; the result decides whether routing continues.
HighlightErrorCallback = void Function(Object error, StackTrace stackTrace)
Called when a synchronous or asynchronous highlighting attempt fails.
ImageErrorBuilder = Widget Function(BuildContext context, Object error, StackTrace stackTrace)
Builds fallback content after an image source fails.
ImageLoadingBuilder = Widget Function(BuildContext context)
Builds placeholder content while an image loads.
KeyEventHandler = void Function(KeyEvent event)
Callback signature for key event listeners registered with InputManager.onKey.
LayoutWidgetBuilder = Widget Function(BuildContext context, BoxConstraints constraints)
Signature for building a widget from the space its parent offers.
ListViewItemBuilder = Widget Function(BuildContext context, int index, bool selected)
Signature for building one row of a ListView.
MarkdownBlockRenderer = Widget Function(BuildContext context, Object node, Widget buildDefault())
Builds one Markdown block, optionally delegating to buildDefault.
Builds the MenuAnchor launcher from the attached MenuController.
MouseEventHandler = void Function(MouseEvent event)
Callback signature for mouse event listeners registered with InputManager.onMouse.
PasteEventHandler = void Function(PasteEvent event)
Callback signature for paste event listeners registered with InputManager.onPaste.
SelectChanged<T> = void Function(int index, SelectOption<T> option)
Signature for callbacks invoked when the highlighted option changes.
SelectConfirmed<T> = void Function(int index, SelectOption<T> option)
Signature for callbacks invoked when the user confirms a selection.
SelectionCopyCallback = void Function(SelectedText selection, {required bool success})
Called after an explicit copy attempt from a document selection.
TickerCallback = void Function(Duration timeStamp)
Signature of a per-frame tick given the time elapsed since the ticker started.
TreeViewItemBuilder<T> = Widget Function(BuildContext context, TreeNode<T> node, bool selected)
Builds caller-owned content for one TreeView row.
ValueChanged<T> = void Function(T value)
Signature for callbacks that receive a changed value of type T.
VoidCallback = void Function()
Callback with no arguments and no return value.
WidgetBuilder = Widget Function(BuildContext context)
Builds a widget from the supplied BuildContext.

Exceptions / Errors

ImageLoadException
Typed failure while acquiring encoded image bytes.
TerminalImageException
A typed failure from native image decoding or allocation.