io.worxbend.tui.dsl
Members list
Type members
Classlikes
A group of collapsible sections of which at most one is open — the policy is w.AccordionState.toggle: opening a section closes the open one, toggling the open one closes it. Each header is a tab stop that Enter or Space toggles; a folded body leaves the tab order, exactly as a lone collapsible's does. The open section fills the rows the headers leave.
A group of collapsible sections of which at most one is open — the policy is w.AccordionState.toggle: opening a section closes the open one, toggling the open one closes it. Each header is a tab stop that Enter or Space toggles; a folded body leaves the tab order, exactly as a lone collapsible's does. The open section fills the rows the headers leave.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait Elementclass Objecttrait Matchableclass AnyShow all
One section of an Element.accordion: the title its header shows and the content it opens onto.
One section of an Element.accordion: the title its header shows and the content it opens onto.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
Text carrying a time-based effect, themed at construction.
Text carrying a time-based effect, themed at construction.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait Elementclass Objecttrait Matchableclass AnyShow all
Attributes
- Companion
- trait
- Supertypes
-
trait Sumtrait Mirrorclass Objecttrait Matchableclass Any
- Self type
-
AnimatedValue.type
The numeric types animateTo is defined for: how a value becomes the Double a Tween moves, and how a sample becomes a value again. Double is the identity; Int rounds half up. Sealed, because a tween over anything else is a different feature — interpolating a Color or a Rect is not a rounding rule.
The numeric types animateTo is defined for: how a value becomes the Double a Tween moves, and how a sample becomes a value again. Double is the identity; Int rounds half up. Sealed, because a tween over anything else is a different feature — interpolating a Color or a Rect is not a rounding rule.
Attributes
- Companion
- object
- Supertypes
-
class Objecttrait Matchableclass Any
- Known subtypes
The ambient time source the animated elements read, so showing a spinner needs no tick plumbing at all.
The ambient time source the animated elements read, so showing a spinner needs no tick plumbing at all.
Before this existed, an animation cost four separate steps: set a tickRate, declare a Signal[Int], override onTick to advance it, and thread the counter through every call site. All four were boilerplate the framework already had the information to do itself.
Reading it is a tracked read, which is what makes this work rather than merely shorten: a view only subscribes to the clock when it actually renders an animation, so a screen with no spinner on it is not woken up by the ticks — where a hand-rolled ticks.get in the view repaints the whole app forever whether anything is moving or not.
One signal per render loop, one shared origin. The value is elapsed time since the process started rather than since a particular runner, so it is meaningful without a runner (a plain unit test reads Duration.Zero until something advances it) and two runners in one JVM agree on what time it is. The Signal carrying it, however, is per render loop, resolved through RenderThread.capture on every read and every advance. It has to be: a Signal's subscriber set is a plain mutable set with no lock, confined to a render thread — and with one signal for the whole process, two runners' render threads both subscribe to and notify it at once. checkRenderThread cannot catch that, because both threads are render threads. What it cost was measurable and silent: with the shared signal put back, the regression test below — two loops, 2000 tracked reads each — sees one loop lose every one of its 2000 subscriptions. An app whose only reactive dependency is the ambient clock (any spinner, orbitSpinner or indeterminateBar) therefore froze mid-animation, with no exception to explain it.
A caller belonging to no runner resolves the one shared unattributed loop, so plain unit tests and freezeAt still see a single clock between them.
Reading the clock also asks for the ticks that advance it. Each read records the interval the caller needs against the loop's current frame, and TuiApp turns one repeating tick on at the shortest interval anything on the frame asked for — and off again when a frame asks for nothing. That is why a spinner spins in an app that configured no tickRate at all, and why an app showing no animation costs no ticks. An app that did set config.tickRate keeps being driven by the runner exactly as before; the demand is then simply not consulted.
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
AnimationClock.type
The running application's cross-cutting services, as a value a helper written outside the app object can be handed.
The running application's cross-cutting services, as a value a helper written outside the app object can be handed.
Everything an application can do to itself — raise a toast, push a screen, open the command palette, run a post-render effect, ask for a repaint, copy to the clipboard, quit — is a protected method on TuiApp, reachable only from inside the app's own body. A view helper in another file therefore either takes one callback per action or gives up and moves back into the app.
This is that whole set as one value. It extends Notifications, so a helper that only needs to notify can ask for the narrower type and a helper that navigates can ask for this one:
def statusFooter(using ReactiveScope, Theme, AppServices): Element =
row(
button("Settings")(summon[AppServices].pushScreen(settingsScreen)),
button("Quit")(summon[AppServices].quit()),
)
TuiApp publishes its own as a given, so a call made from any method of the app resolves it with nothing to write at the call site.
Ownership and threads: an instance belongs to one TuiApp and every method on it must be called on that app's render thread — which every event handler, timer body and Async continuation already is. Background work must call RenderThread.capture() before going async, exactly as it must to touch a Signal.
Attributes
- Companion
- object
- Supertypes
Attributes
- Companion
- trait
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
AppServices.type
A text input with a live suggestion dropdown: typing filters suggestions (subsequence match), Up/Down move the highlight, Enter accepts it into the input and fires onAccept.
A text input with a live suggestion dropdown: typing filters suggestions (subsequence match), Up/Down move the highlight, Enter accepts it into the input and fires onAccept.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait Elementclass Objecttrait Matchableclass AnyShow all
App-owned state for an autocomplete element: the text being typed plus the highlighted suggestion.
App-owned state for an autocomplete element: the text being typed plus the highlighted suggestion.
Versioned over both: version is the input's version plus this state's own count of highlight writes, so a highlight moved between frames schedules a frame just like typed text does. Render-thread-only.
Attributes
- Supertypes
-
trait Versionedclass Objecttrait Matchableclass Any
A short inline label, themed at construction.
A short inline label, themed at construction.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait Elementclass Objecttrait Matchableclass AnyShow all
A binding's stable name, which a user keymap rebinds it by (see Keymap).
A binding's stable name, which a user keymap rebinds it by (see Keymap).
Unless a binding names one with withId, its id is its description slugged — lower case, every run of anything but letters and digits turned into one - — so binding("ctrl+s", "save") is save and "go to top" is go-to-top.
Attributes
- Companion
- object
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
A clickable navigation trail over w.Breadcrumb: a left click on a visible item hands its index to onSelect; the … fold and the separators select nothing. One row; the trail folds its middle items when it runs out of columns. Not focusable — a breadcrumb is a pointer affordance, and the keyboard reaches the same places through the app's own back binding.
A clickable navigation trail over w.Breadcrumb: a left click on a visible item hands its index to onSelect; the … fold and the separators select nothing. One row; the trail folds its middle items when it runs out of columns. Not focusable — a breadcrumb is a pointer affordance, and the keyboard reaches the same places through the app's own back binding.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait Elementclass Objecttrait Matchableclass AnyShow all
A coarse width band for a terminal, the vocabulary Element.responsive and TuiApp.breakpoint branch on.
A coarse width band for a terminal, the vocabulary Element.responsive and TuiApp.breakpoint branch on.
Bands are width-only and cumulative: Medium means "at least 80 columns", not "exactly 80 to 119". Height is left out deliberately — a Size => Element builder still sees both axes, and short-but-wide terminals want a different decision than narrow ones, so folding both into one band would hide the distinction rather than name it.
The thresholds are the ones terminals actually cluster around: 80 columns is the historical default, 120 the common width of a maximized modern window, and anything under 60 is a split pane or a phone-sized SSH session.
Attributes
- Companion
- object
- Supertypes
-
trait Enumtrait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
Attributes
- Companion
- enum
- Supertypes
-
trait Sumtrait Mirrorclass Objecttrait Matchableclass Any
- Self type
-
Breakpoint.type
A pressable button: Enter or Space triggers action while focused.
A pressable button: Enter or Space triggers action while focused.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait Elementclass Objecttrait Matchableclass AnyShow all
The variants of button. Default is what every button resolves when no .variant(...) is given, so a theme that styles "button" styles every button and "button.primary" only refines it.
The variants of button. Default is what every button resolves when no .variant(...) is given, so a theme that styles "button" styles every button and "button.primary" only refines it.
Attributes
- Supertypes
-
trait Enumtrait Serializabletrait Producttrait Equalstrait ComponentRoleclass Objecttrait Matchableclass AnyShow all
A free-form drawing surface, with the sub-cell resolution and the marker glyph reachable from the view.
A free-form drawing surface, with the sub-cell resolution and the marker glyph reachable from the view.
A terminal cell is a single character, so a plot drawn one dot per cell is very coarse. The underlying io.worxbend.tui.widgets.Canvas can do better by packing several sub-pixels into one cell — two stacked half-blocks (▀, ▄, █), or the eight dots of a braille pattern (⣿), which is eight times the detail of one marker per cell. Before this node the canvas(...) factory built the widget with both of those parameters left at their defaults and gave back a plain WidgetElement, so a view had no way to ask for anything but the coarsest mode; getting braille meant dropping out of the DSL and constructing widgets.Canvas by hand.
The builders read the same way as the ones OrbitSpinnerElement already carries, which is the other place in this package that paints onto a canvas: .markers(glyph) picks one-glyph-per-cell drawing with that glyph, .halfBlocks and .braille pick the two finer modes. The marker is read only in cell mode — the finer modes have fixed glyph sets — so setting one does not silently switch resolution back.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait Elementclass Objecttrait Matchableclass AnyShow all
How a focused text-entry node shows its insertion point: as the reverse-video cell the widget paints, as the terminal's own cursor, or as both.
How a focused text-entry node shows its insertion point: as the reverse-video cell the widget paints, as the terminal's own cursor, or as both.
The two are not the same thing. The painted cell is what a sighted user sees, and it is all a frame snapshot records. The terminal's cursor — the hardware caret — is what a screen reader announces as the insertion point and what an input method editor anchors its candidate popup to; neither can see a styled cell. Every text node moves both by default, and .caretStyle(...) on the node picks one of them instead: Painted for an app that hid the terminal cursor on purpose and wants it to stay hidden, Hardware for one that would rather let the terminal draw the caret in the user's own configured shape and colour than paint a block over the text.
Attributes
- Supertypes
-
trait Enumtrait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
A labelled checkbox. Space/Enter (or a click) flips it while focused.
A labelled checkbox. Space/Enter (or a click) flips it while focused.
The node holds the value the view read, not the signal behind it: the factory does the tracked read, so the view's scope subscribes and any writer at all — a background load, another control — repaints the checkbox. onChange carries the new value back to whoever owns the state.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait Elementclass Objecttrait Matchableclass AnyShow all
What a custom ContainerElement's placement function is told about one child: where it sits in the child list, the .key it was given, the layout extension it carries, and how big its content measures.
What a custom ContainerElement's placement function is told about one child: where it sits in the child list, the .key it was given, the layout extension it carries, and how big its content measures.
The measurements are the same Element.intrinsicHeight / Element.intrinsicWidth the built-in containers lay out by, taken with the child's own constraint set aside — the constraint is reported on its own, in constraint, because a custom layout decides for itself what a .length(n) means. None means "cannot say", never zero.
A view of the child, not a copy: built fresh for every paint, read during that paint, on the render thread.
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
A toggleable section: ▸ title collapsed, ▾ title plus the body expanded; Enter/Space toggle while focused. Collapsed bodies leave the tab order entirely.
A toggleable section: ▸ title collapsed, ▾ title plus the body expanded; Enter/Space toggle while focused. Collapsed bodies leave the tab order entirely.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait Elementclass Objecttrait Matchableclass AnyShow all
A 256-colour palette grid over a caller-owned w.ColorPickerState. While focused, the arrows move the cursor swatch and Enter or Space chooses it, recording it in state.chosen and handing the Color.Indexed to onSelect. A click on a swatch moves the cursor there and chooses it. Claims the 36×17 box the grid and its caption measure.
A 256-colour palette grid over a caller-owned w.ColorPickerState. While focused, the arrows move the cursor swatch and Enter or Space chooses it, recording it in state.chosen and handing the Color.Indexed to onSelect. A click on a swatch moves the cursor there and chooses it. Claims the 36×17 box the grid and its caption measure.
In w.ColorPickerMode.Rgb the R/G/B fields beside the grid take part too: Tab moves the keyboard from the grid through red, green and blue and Shift+Tab back — from the blue field Tab (and from the grid Shift+Tab) is left unconsumed, so focus moves on and nobody is trapped. On a field, digits type, Backspace deletes, Up/Down step the value, and Enter chooses the fields' Color.Rgb — only while all three are in 0..255. A click on a swatch chooses its RGB value; a click on a field gives it the keyboard.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait Elementclass Objecttrait Matchableclass AnyShow all
Children stacked top to bottom.
Children stacked top to bottom.
The same vocabulary as RowElement one axis over: an .auto child is exactly as tall as it measures, and .alignItems(...) / .alignSelf(...) place children horizontally — a button in a centred column is as wide as its label rather than the column. Its measured height is the w.Column's own, so painting and measurement share one allocation.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait FlexContainertrait Elementclass Objecttrait Matchableclass AnyShow all
Attributes
- Companion
- trait
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
ComponentRole.type
A typed handle on a component's StateStyles in a Theme: theme.withComponent(ButtonRole.Primary, …) and button("Save").variant(ButtonRole.Primary).
A typed handle on a component's StateStyles in a Theme: theme.withComponent(ButtonRole.Primary, …) and button("Save").variant(ButtonRole.Primary).
A role is a StyleName with a type, so a variant is checked at compile time and a theme file can still name it as text. The built-in roles are the enums and objects below; an application adds its own with ComponentRole.named, which is how a "button.toolbar" variant gets in without the library knowing about it.
Attributes
- Companion
- object
- Supertypes
-
class Objecttrait Matchableclass Any
- Known subtypes
-
enum ButtonRoleobject DialogRoleobject InputRoleobject ListRoleobject SearchRoleobject TableHeaderRoleShow all
A dialog that owns its keys: Left/Right (and Tab) move between the buttons, Space or Enter presses the selected one, Esc cancels.
A dialog that owns its keys: Left/Right (and Tab) move between the buttons, Space or Enter presses the selected one, Esc cancels.
Element.dialog draws the same picture and answers no keys at all — its own documentation calls it "a picture of a dialog, not a controller". That left every application writing the same three things by hand for a "really quit?": a selected-index signal, the Left/Right/Enter/Esc wiring, and the modal Screen to push it on. This node is the controller half; Screen.confirm is the whole thing, selection state included.
Selection is caller-owned, like every other control in this package: the node holds the index the view read and an onSelect to carry a new one back. onPress is handed the index of the button that was pressed — button 0 is the confirming one by convention, because that is the order the labels are given in.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait Elementclass Objecttrait Matchableclass AnyShow all
Print mode: render any view, widget or Text once to standard output as styled text, with no runner, no event loop and no terminal taken over — the way Rich prints a table or Ink renders to a string.
Print mode: render any view, widget or Text once to standard output as styled text, with no runner, no event loop and no terminal taken over — the way Rich prints a table or Ink renders to a string.
This is what opens every widget — tables, trees, charts, Markdown, panels — to a command-line tool that will never be a full-screen application: Console.print(panel("Build")(table(rows, header))) lays the view out at the terminal's width, measures the rows it needs, composes a frame through Snapshot and writes it as newline-separated rows with the colour depth the environment allows. The encoding is FrameEncoder.encodeLines in tui-terminal: no cursor movement, styles as deltas from the terminal default, a reset on every row that set one — and, when colour is off, no escape sequence at all, so NO_COLOR=1 mytool > report.txt leaves a plain text file behind.
width and colors default to what detectedWidth and detectedColors read from the process: the terminal's width when standard output is one, else COLUMNS, else 80 columns; the colour depth ColorDepth.detect resolves (NO_COLOR, FORCE_COLOR, CLICOLOR_FORCE, TERM=dumb and the terminal's capability) when standard output is a terminal, and no colour when it is not, unless one of the force variables says otherwise. The height is the view's own measurement — Element.intrinsicHeight at that width — falling back to LINES, then 24 rows, for a view that cannot say (one whose root is .fill, say); pass height to decide yourself.
What it deliberately is not: interactive or animated, for the same reasons Snapshot is not. Focus is drawn on the first focusable element, an animated element renders at whatever position it computes for the time it is handed, and reactive reads subscribe nothing. A TuiApp that should degrade to this when it has no terminal sets RunnerConfig.withNonInteractive instead of calling this directly — see io.worxbend.tui.runtime.NonInteractivePolicy.
Shadowing, stated plainly because it bites: under import io.worxbend.tui.dsl.* the name Console resolves here rather than to scala.Console, so an app that wrote Console.println(...) or Console.err with the one import has to write scala.Console.err (or plain println). The name is kept because it is the one every terminal toolkit uses for exactly this object.
Callable from any thread: it registers no render loop and writes no signal. The print variants write to the standard-output descriptor as UTF-8 regardless of the platform charset — every border and glyph is non-ASCII, and a POSIX locale would otherwise print them as ? — and flush after each call.
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
Console.type
A container whose layout is the application's own: container(children*)(place, chrome).
A container whose layout is the application's own: container(children*)(place, chrome).
Every paint, place is handed the container's area and one ChildInfo per child and answers one Rect per child, in child order. Each child is painted into its rect clipped to the container's area — a child the answer leaves out (a shorter Seq) is not painted, and a rect partly outside the area is cut down to the part inside it. chrome, when given, is painted across the whole area first, under the children: a background, a frame, grid lines.
Everything that is not placement stays the framework's. The children are ordinary children of the tree, so the focus pass numbers them in child order (the Tab order), wraps each interactive one so the area it was painted into is what the mouse router hit-tests, and records each one's bounds for boundsOf(key). A layout cannot get any of that wrong because it never sees it.
place runs on the render thread during the paint and must be a pure function of its arguments: it is called again on every frame, and nothing it returns is kept between them. The container cannot measure itself — its size depends on a function it cannot invert — so it answers through measure: the rows the layout needs at a width, from the same ChildInfos, or None for "cannot say" (the default, which fills). With an answer, .auto and every column that measures its children sizes its height to its content. measureWidth is the horizontal counterpart: columns needed at a height, for .auto in a row. .length(n) still fixes the allocation. Both measurements follow the same rules as place: render thread, pure. Content style cascades to the children, never to chrome. Unplaced children are excluded from keyboard input and Tab traversal for the painted frame.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait Elementclass Objecttrait Matchableclass AnyShow all
A right-click menu around target: a right-button press anywhere inside it — that nothing inside consumed — opens the existing w.Menu over items at the cell clicked, drawn through the frame root and flipped to open leftwards or upwards near the frame's edges (w.ContextMenu.placement). While it is open Up/Down move the highlight whatever holds focus, Enter (or a click on an item) hands the item's index to onSelect and closes it, and Esc, Tab or a click elsewhere close it. Lays out, measures and paints exactly as target.
A right-click menu around target: a right-button press anywhere inside it — that nothing inside consumed — opens the existing w.Menu over items at the cell clicked, drawn through the frame root and flipped to open leftwards or upwards near the frame's edges (w.ContextMenu.placement). While it is open Up/Down move the highlight whatever holds focus, Enter (or a click on an item) hands the item's index to onSelect and closes it, and Esc, Tab or a click elsewhere close it. Lays out, measures and paints exactly as target.
decorated is the framework's slot for the decorated children; application code never sets it.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait Elementclass Objecttrait Matchableclass AnyShow all
A sortable, filterable table. Up/Down move the row selection while focused, and PageUp/PageDown turn the page once state.paging is set (they are left unconsumed otherwise, so they keep bubbling). Sorting and filtering have no built-in keys — drive state.sortBy/state.setFilter from the app's own bindings.
A sortable, filterable table. Up/Down move the row selection while focused, and PageUp/PageDown turn the page once state.paging is set (they are left unconsumed otherwise, so they keep bubbling). Sorting and filtering have no built-in keys — drive state.sortBy/state.setFilter from the app's own bindings.
A click on a body row selects it; a drag that starts on the table and covers a couple of cells selects cell text instead (see .selectable). Alone among the selectable collections this one has no wheel behavior. Its selection indexes the visible page (table.visibleRows(state)), so a wheel step would have to decide whether it moves within the page or turns it, and either answer is wrong for half the tables; the page keys say which one the app meant. Bind onMouseEvent if this table wants one of the two.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait Elementclass Objecttrait Matchableclass AnyShow all
An interactive month grid over a caller-owned w.DatePickerState. While focused, Left/Right move the cursor a day and Up/Down a week — across month and year ends, so the grid follows — PageUp/PageDown move it a month, t jumps to today, and Enter or Space chooses the cursor's date and hands it to onSelect; a click on a day chooses that day. The cursor wears the focus style; the chosen date, once the cursor leaves it, is underlined. Days outside the state's min/max are dimmed, and neither the keys nor a click can reach them.
An interactive month grid over a caller-owned w.DatePickerState. While focused, Left/Right move the cursor a day and Up/Down a week — across month and year ends, so the grid follows — PageUp/PageDown move it a month, t jumps to today, and Enter or Space chooses the cursor's date and hands it to onSelect; a click on a day chooses that day. The cursor wears the focus style; the chosen date, once the cursor leaves it, is underlined. Days outside the state's min/max are dimmed, and neither the keys nor a click can reach them.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait Elementclass Objecttrait Matchableclass AnyShow all
A decorator any element can take: .border(...), .padding(...), .background(...), .shadow, .clip.
A decorator any element can take: .border(...), .padding(...), .background(...), .shadow, .clip.
Built on DecoratingElement, so the wrapped node is its one child — focused, hit-tested, recorded and routed as itself, with its own key and handlers — but unlike the transparent framework wrappers this one is a box of its own. It keeps its own props: the layout extensions the wrapped node carried when it was decorated (.length, .fill, .alignSelf, a grid spot) are lifted onto the decorator, because they were about where the node goes and the decorated box is now what goes there; builders written after the decorator — .fill, .fg(...), .onKeyEvent — land on the box. Its style is the content style, layered under what the wrapped node drew inside the decoration, as on every container; a border's own colour is the frameStyle the border was given.
The decoration's cells are added to the measurement (text("hi").border() is four columns by three rows), and the built-in handlers stay on the wrapped node, which is the one the router hands its own area to.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait Elementclass Objecttrait Matchableclass AnyShow all
What a DecoratedElement does around the node it wraps — the five decorators any element can take.
What a DecoratedElement does around the node it wraps — the five decorators any element can take.
Attributes
- Supertypes
-
trait Enumtrait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
The picture Element.dialog draws: a centered box with a title, a message and a row of buttons, selected highlighted. No keys and no callbacks — see ConfirmDialogElement for the controller.
The picture Element.dialog draws: a centered box with a title, a message and a row of buttons, selected highlighted. No keys and no callbacks — see ConfirmDialogElement for the controller.
Styled through the theme's "dialog" component role (DialogRole): its base is layered over bodyStyle (the theme's primary, from the factory) and the node's own style over both; the selected button takes "dialog.selected", or selectedStyle (the theme's focus) when the theme has no such component. Built on the render thread like every node; the value is immutable.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait Elementclass Objecttrait Matchableclass AnyShow all
The modal boxes — dialog and confirmDialog — under "dialog". Its base is layered over the theme's primary for the frame, title and message; DialogRole.Selected is the selected button, which falls back to the theme's focus cue (on a dialog) or the focus cue / resting underline (on a confirmDialog) when the theme leaves it silent.
The modal boxes — dialog and confirmDialog — under "dialog". Its base is layered over the theme's primary for the frame, title and message; DialogRole.Selected is the selected button, which falls back to the theme's focus cue (on a dialog) or the focus cue / resting underline (on a confirmDialog) when the theme leaves it silent.
Attributes
- Supertypes
-
trait Singletontrait Producttrait Mirrortrait Serializabletrait Producttrait Equalstrait ComponentRoleclass Objecttrait Matchableclass AnyShow all
- Self type
-
DialogRole.type
A unified diff drawn by w.DiffView — git diff output read with Patch.parse, or two texts compared with Patch.of — scrolled and stepped through by a caller-owned w.DiffViewState.
A unified diff drawn by w.DiffView — git diff output read with Patch.parse, or two texts compared with Patch.of — scrolled and stepped through by a caller-owned w.DiffViewState.
Focusable. While focused, n or ] puts the next hunk's header on the top row and p or [ the previous one; Up/Down/PageUp/PageDown and the wheel scroll, Home and End jump to the ends. The keys are the element's own, like splitPane's [/]: an app binding on the same letter only fires while some other element has focus. .split lays the old and new sides next to each other, .contextLines(n) folds long runs of unchanged lines, .lexer(…) highlights the code, and .withOptions replaces every knob at once. A measured leaf: it reports one row per header and line, so it sizes itself in a column or inside a scrollView.
The state is render-thread-only and keeps the rows of the last patch it laid out; hand the node the same Patch value each frame (keep it in a val or a Signal) and the diff is not recomputed between frames.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait Elementclass Objecttrait Matchableclass AnyShow all
A filesystem snapshot browser. Up/Down move the selection, Enter expands or collapses the selected directory, while focused; the wheel moves the selection on hover. Neither painting nor navigation acquires listings. The caller loads visible branches explicitly and requests a redraw after installing a snapshot.
A filesystem snapshot browser. Up/Down move the selection, Enter expands or collapses the selected directory, while focused; the wheel moves the selection on hover. Neither painting nor navigation acquires listings. The caller loads visible branches explicitly and requests a redraw after installing a snapshot.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait Elementclass Objecttrait Matchableclass AnyShow all
How a modal Screen may close itself, without the application writing a handler for it.
How a modal Screen may close itself, without the application writing a handler for it.
A sealed set of cases rather than two booleans, so a call site reads as one decision — Dismissal.Escape — instead of a pair of unlabelled true/false arguments whose order nobody remembers.
Every case is honoured only for Presentation.Modal. A full screen replaces what is beneath it, so there is no whitespace around it that counts as "outside", and closing it on Esc would take the user somewhere the screen never said it was willing to go.
Attributes
- Supertypes
-
trait Enumtrait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
The node dismissibleOverlay builds: content painted over the whole area, with the outside-press behaviour as the node's own built-in rather than a sibling backdrop's, so it can read where its subtree was painted. Transparent to layout and measurement — it claims and measures as content does.
The node dismissibleOverlay builds: content painted over the whole area, with the outside-press behaviour as the node's own built-in rather than a sibling backdrop's, so it can read where its subtree was painted. Transparent to layout and measurement — it claims and measures as content does.
Owned by the view that built it, like every node; the recorded bounds it reads belong to the host and are resolved when a press arrives, on the render thread.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait Elementclass Objecttrait Matchableclass AnyShow all
The type of a drag-and-drop payload, as a value: a draggable[A] and a dropTarget[A] meet only when they were built against the same key, which is what lets a drop hand the target an A with no runtime type test and no reflection.
The type of a drag-and-drop payload, as a value: a draggable[A] and a dropTarget[A] meet only when they were built against the same key, which is what lets a drop hand the target an A with no runtime type test and no reflection.
Keys compare by identity. The built-in givens cover String, Int and Long; an app's own type gets one by declaring it once where both ends can see it:
final case class Card(rank: Int)
given DragKey[Card] = DragKey("card")
text("7♠").draggable(Card(7))
pile.dropTarget[Card](_.rank > 5)(card => moveTo(pile, card))
Two keys for one type are two kinds of payload — a DragKey[String]("file") and the built-in string key do not meet — which is also how to keep two unrelated drags of the same type apart.
How the value crosses without a cast: a payload packed by this key carries a closure that writes the value into this key's typed, thread-local receiver, and only this key can unpack it. Keys (including the built-in givens) may be shared by concurrent runners; receiver state is restored after each call, including a failed or nested load.
Attributes
- Companion
- object
- Supertypes
-
class Objecttrait Matchableclass Any
What dropTarget[A](accept)(onDrop) installs: whether a payload is one this target takes, and taking it.
What dropTarget[A](accept)(onDrop) installs: whether a payload is one this target takes, and taking it.
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
A collapsed option chooser: one row showing the option in force, and, while open, the whole option list floating beneath it as a bordered popup.
A collapsed option chooser: one row showing the option in force, and, while open, the whole option list floating beneath it as a bordered popup.
The difference from SelectElement is what happens with a long list. select steps one option per keystroke and never shows more than the current one, so choosing the thirtieth of forty options takes thirty keystrokes and the user cannot see what they are choosing between. A dropdown shows the list.
Keys while focused. Closed: Enter, Space or Down opens the list. Open: Up/Down move the highlight, Enter commits it through onSelect, Escape closes without changing anything, and Tab closes it on its way to the next control. Note that an open dropdown consumes Escape — an app that binds Escape globally will not see it while a list is showing, which is the same bargain any modal makes and the reason the highlight is not the committed value.
A click on the closed row opens the list; a click on an option commits it; a click anywhere else — the row itself included — closes the list without committing, and is spent on that: the control under the pointer does not also receive it, unless the dropdown is built with passThroughOutside. The wheel over the list moves the highlight.
The list is drawn through the frame root, the way PortalElement draws, so the node claims one row whether the list is open or not and nothing around it moves when it opens. The popup sits under the row when the frame has room for it there and above the row when it does not, and is clipped to the frame — never to the panel or pane the row sits in. Rendered outside a host, with no frame root to float through, the list paints in place under the row, clipped only by the buffer.
floating is the framework's slot: the focus pass hands back the decorated scrim and list nodes through it, so the mouse router can find the list where it was painted. Application code never sets it.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait Elementclass Objecttrait Matchableclass AnyShow all
inner with effect applied, at elapsed, over exactly the cells inner was painted into — what element.withEffect(...) builds. The layout extensions the wrapped node carried are lifted onto this node, as every decorator does, and everything else (focus, handlers, measurement) reads through to inner.
inner with effect applied, at elapsed, over exactly the cells inner was painted into — what element.withEffect(...) builds. The layout extensions the wrapped node carried are lifted onto this node, as every decorator does, and everything else (focus, handlers, measurement) reads through to inner.
The effect runs inside the paint, straight after inner painted, so it sees the element's own cells and nothing a later sibling or a portal draws on top. Immutable; render-thread-only like every widget paint.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait Elementclass Objecttrait Matchableclass AnyShow all
A node of the retained-mode UI tree.
A node of the retained-mode UI tree.
Every element ultimately renders through a tui-core Widget — the DSL is a declarative layer over tui-widgets, never a parallel rendering path. The hierarchy is plain data: construction tests can inspect props, children and widget, and styling extensions rebuild nodes instead of mutating them.
The node types' constructors, copy methods and pattern extractors are not part of the compatibility contract — the factories (text, panel, list, …) and the fluent builders on them are. A node gains a field whenever its factory gains an option, and before 1.0 a node may become a final class behind its factory with no user-visible change, so application code names a node type at most as a result type and never destructures one.
The node types themselves live one family per file (LayoutElements, DisplayElements, …). What closes the hierarchy to outside implementors is the private[dsl] on withProps: no class outside this package can implement a package-private member, so no class outside this package can extend Element. That is why the trait is deliberately not sealed — sealing would add nothing but a rule that all 53 node types share one file.
Attributes
- Companion
- object
- Supertypes
-
class Objecttrait Matchableclass Any
- Known subtypes
-
class AccordionElementclass AnimatedTextElementclass AutocompleteElementclass BadgeElementclass BreadcrumbElementclass ButtonElementclass CanvasElementclass CheckboxElementclass CollapsibleElementclass ColorPickerElementclass ConfirmDialogElementclass ContainerElementclass ContextMenuElementclass DataTableElement[K]class DatePickerElementclass DialogElementclass DiffViewElementclass DirectoryTreeElementclass DropdownElementclass FilePickerElementtrait FlexContainerclass ColumnElementclass PanelElementclass RowElementclass StyledTableElementclass TableElementclass FlowElementclass FocusGroupElementclass GaugeElementclass GridElementclass HexViewerElementclass IndeterminateElementclass InputElementclass InspectElementclass InteractiveWidgetElement[S]class LayersElementclass LazyListElementclass LineElementclass LinearSpinnerElementclass ListElementclass LogConsoleElementclass LogElementclass MarkdownStreamElementclass MarqueeElementclass MenuBarElementclass MenuElementclass MultiProgressElementclass NoticeElementclass NumberInputElementclass OrbitSpinnerElementclass PaginatorElementclass PlaceholderElementclass PortalElementclass PositionedElementclass ProgressBarElementclass PromptComposerElementclass QrCodeElementclass RadioGroupElementclass RangeSliderElementclass ResponsiveElementclass RichTextElementclass ScrollViewElementclass ScrollbarElementclass SearchBarElementclass SelectElementclass SelectionListElementclass SkeletonElementclass SliderElementclass SpacerElementclass SparklineElementclass SpinnerElementclass SpinnerGridElementclass SplitPaneElementclass TabbedContentElementclass TabsElementclass TagInputElementclass TemplateInputElementclass TextAreaElementclass TextElementclass TimePickerElementclass ToggleElementclass ToolbarElementclass TreeElementclass TreeTableElement[K]class WidgetElementclass WindowElementclass WindowStackElementclass WizardElementShow all
Every element factory, in one place: Element.text(...), Element.panel(...), and so on. The methods themselves live in ElementFactories — see there for why — and the package re-exports all of them, so an application that wrote import io.worxbend.tui.dsl.* just writes text(...).
Every element factory, in one place: Element.text(...), Element.panel(...), and so on. The methods themselves live in ElementFactories — see there for why — and the package re-exports all of them, so an application that wrote import io.worxbend.tui.dsl.* just writes text(...).
Attributes
The DSL's render-and-dispatch engine, with no loop and no key policy of its own.
The DSL's render-and-dispatch engine, with no loop and no key policy of its own.
TuiApp is this class plus opinions: Tab and Shift+Tab move focus, Ctrl+P opens the command palette, Ctrl+C quits, screens stack, toasts expire, a splash plays first. A host that already owns a loop — an application built around its own TerminalRunner, or one embedding a glyphora panel in a loop it did not write — constructs an ElementHost instead: it calls render once per frame and a dispatch* method per event, and decides for itself what the keys none of them consumed should mean.
What it does own is the part that would otherwise have to be rewritten: resolving the responsive view for the size actually being painted, reconciling focus across frames (so the highlight follows the element and not the screen position), decorating the tree with the focus cue, and routing keys, mouse events and pastes to the element that is on screen rather than to a freshly evaluated tree. The same session also owns hook identity and drains portals after ordinary painting. A portal escapes its containers, but never the host's render area intersected with the destination buffer. Hooks survive until they are unvisited in a frame, the host is discarded, or reset is called. Scheduling, reactive scope disposal and caller-owned resources remain the embedding loop's responsibility.
'''Ownership and threads.''' One instance belongs to one loop. Every method must be called on that loop's render thread: the instance holds the focus bookkeeping and the decorated tree of the last frame, and neither is synchronised. Nothing here schedules a frame — a host that changes something redraws when it decides to.
'''Focus changes take effect on the next frame.''' Events are routed against the tree the last render painted, which is the tree the person at the terminal is actually looking at. So focusNext, focusToKey and clearFocus change where focus will be, and the next render is what makes the following key go somewhere else. In a loop that redraws after handling an event — which is every loop — that is invisible; it is written down because a test that dispatches twice with no frame in between would otherwise be puzzling.
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
The cross-cutting properties every Element carries: its style, an optional layout constraint (how much space it claims inside a row/column/panel), its event handlers, and focus participation. Styling and layout extension methods produce a new element with updated props — elements stay immutable values.
The cross-cutting properties every Element carries: its style, an optional layout constraint (how much space it claims inside a row/column/panel), its event handlers, and focus participation. Styling and layout extension methods produce a new element with updated props — elements stay immutable values.
focusable opts the element into tab-order traversal, and autofocus asks for the keyboard the frame the element first appears in — see AutofocusRequest for why "first appears" and not "every frame". Everything the framework itself sets each render lives in focusState, which user code can read but not build.
onKeyUp is the handler .onKeyRelease(...) installs. It is separate from onKey rather than a flag on it, because a release is a different event and an element that wants both wants two bodies: firing the press handler again on the way up would double every action the element takes.
glyphs is the glyph ceiling the themed factory that built this element read off the Theme — see io.worxbend.tui.core.GlyphSupport. It rides on the props rather than on each node so that a fluent builder such as panel(...).borderType(BorderType.Thick) keeps it: the ceiling belongs to the terminal the app is running on, not to the border the author picked, so an explicit choice still degrades on a terminal that cannot draw it. An element built outside a themed factory keeps the permissive default and degrades nothing.
caretStyle is read only by the text-entry nodes: whether, while focused, they paint their cursor cell, report it for the terminal's own cursor to follow, or both — see CaretStyle. It rides on the props so one .caretStyle(...) builder serves every text node rather than each carrying a field of its own.
pointerShape is the mouse pointer .pointer(shape) asked for over this element — an explicit request, which wins over the default an interactive node declares through Element.pointerShape and, unlike that default, also covers the node's children. None means "whatever the node itself says".
disabled is what .disabled(cond) writes — the author's word, on this node. The effective state, which also covers every descendant of a disabled node, is focusState.disabled, and that is what the router and the widgets read. hoverStyle and pressedStyle are the optional cues .hoverStyle(...)/.pressedStyle(...) install, layered over the node's style while focusState.hovered/focusState.pressed holds; None draws nothing extra, so an app that never asks for them never pays for mouse-motion tracking either.
onMouseContext is the handler .onMouse(ctx => …) installs: the same events as onMouse, handed over with the element's own area and the position relative to it — see MouseContext. It runs after onMouse and before the built-in behaviour.
trapFocus is what .trapFocus sets: while focus is inside this subtree, Tab and Shift+Tab cycle within it.
alignSelf is where .alignSelf(...) places this element across its container's axis — see io.worxbend.tui.core.CrossAlign; None takes the container's own alignment. ensureVisible is what .ensureVisible sets: an enclosing scrollView scrolls to keep this element on screen. gridSpot is where .at(row, col), .span(rows, cols) and .area(name) put this element inside a grid; outside one it is unused.
variant is the ComponentRole .variant(role) picked — ButtonRole.Primary — which the focus pass looks up in the app's theme instead of the node type's own default role. lateBinding is how a themed factory that saw only the ambient default theme lets the focus pass re-resolve the node against the app's theme — see LateBinding.
selectable is what .selectable(enabled) set: Some(false) opts this node and its subtree out of mouse text selection, Some(true) opts a node in that is not selectable by default, None keeps the node type's default — see TextSelection. dragPayload and dropTarget are what .draggable(payload) and .dropTarget[A](accept)(onDrop) install — see DragKey. The internal captureOwner reference binds a signal-backed built-in to its caller-owned state across rebuilding; fluent props copies retain it. It is not a public capture-identity API.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
The decorated element tree of the last frame as text — one line per node with its type, key, focus index, the focused/inert/disabled/hovered/pressed marks, its constraint and the rect it was painted into — for the question a frame dump cannot answer: why did that element not get focus, not get the click, not get drawn where it should.
The decorated element tree of the last frame as text — one line per node with its type, key, focus index, the focused/inert/disabled/hovered/pressed marks, its constraint and the rect it was painted into — for the question a frame dump cannot answer: why did that element not get focus, not get the click, not get drawn where it should.
column @ 0,0 20x4
text @ 0,0 20x1
row Length(1) @ 0,1 20x1
spacer @ 0,1 10x1
button key=save focus=0 focused Length(10) @ 10,1 10x1
spacer @ 0,2 20x2
Each node names itself through Element.debugName — no reflection anywhere, which is what keeps native images reflect-config-free. The bounds column comes from the host's NodeBounds recorder and reads - for a node that was not recorded: recording was off for that frame, it was the narrow recording that leaves unkeyed leaves out (see ElementHost.enableFullBoundsRecording), or the node was scrolled entirely out of view. A node inside a scroll view keeps frame coordinates, so a partly visible one can show a negative y.
The focus-pass wrappers (TrackedElement, PointerElement, BoundsElement, the scroll viewport) are folded into the node they wrap: the wrapper's bookkeeping becomes the line's focus= index and bounds, and the wrapped node's name and props are what is printed.
'''Threads.''' The tree belongs to the loop that painted it, so call this on the render thread — from a test, pilot.readOnRenderThread(ElementTreeSnapshot.render(app)). The bounds read is of the last published frame.
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
ElementTreeSnapshot.type
Confines a failing subtree to its own area: errorBoundary(fallback)(subtree).
Confines a failing subtree to its own area: errorBoundary(fallback)(subtree).
The view is the app's own code, and a throwable out of it ends the run as RunnerError.Handler — correctly, since an app that cannot draw a frame has no defined next frame. But one widget fed a bad value should not take the whole screen down with it. This node catches a non-fatal throwable at either moment the subtree can fail: while it is built (subtree is by-name and evaluated here, once per element) and while it is painted (the inner widget's render). Either way fallback(error) is painted in the area the subtree was given — on top of a cleared area, so a half-drawn widget leaves no debris — and the failure is logged at SEVERE on the io.worxbend.tui.dsl logger, where a JulBridge ring and a logConsole can show it; built with a ring (errorBoundary(fallback, ring)) it is appended to that LogRing at Error under the same logger name instead, with no bridge needed. Logged, the same failure again (same type, message and throw site), as a subtree that stays broken produces on every frame, goes out at FINE. Nothing is remembered between frames: the view is rebuilt on the next redraw and the subtree gets to try again, so a failure that was transient heals on its own.
Transparent otherwise, like every decorator: a healthy subtree measures, focuses and routes events as itself. Fatal throwables (OutOfMemoryError, InterruptedException) are not caught.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait Elementclass Objecttrait Matchableclass AnyShow all
A file chooser over a FilePickerState: arrows navigate, Enter opens directories or accepts a file into state.chosen, and the wheel moves the selection on hover. chosen is the accepted path the view read, tracked at construction.
A file chooser over a FilePickerState: arrows navigate, Enter opens directories or accepts a file into state.chosen, and the wheel moves the selection on hover. chosen is the accepted path the view read, tracked at construction.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait Elementclass Objecttrait Matchableclass AnyShow all
App-owned state for a local filePicker: an initially unloaded tree plus the accepted file. Call tree.loadVisible() explicitly before showing it, outside view/painting. The picker loads new branches synchronously from its Enter handler; use directoryTree with asynchronous snapshots for slow filesystems.
App-owned state for a local filePicker: an initially unloaded tree plus the accepted file. Call tree.loadVisible() explicitly before showing it, outside view/painting. The picker loads new branches synchronously from its Enter handler; use directoryTree with asynchronous snapshots for slow filesystems.
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
Fills its whole area with fill (a solid background) before rendering inner — what the chrome bars use to read as continuous surfaces. Transparent to focus, measurement and event routing.
Fills its whole area with fill (a solid background) before rendering inner — what the chrome bars use to read as continuous surfaces. Transparent to focus, measurement and event routing.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait Elementclass Objecttrait Matchableclass AnyShow all
A container that arranges its children along an axis, so .gap/.center/.spaceBetween can be typed to the containers they actually do something on instead of silently being the identity everywhere else.
A container that arranges its children along an axis, so .gap/.center/.spaceBetween can be typed to the containers they actually do something on instead of silently being the identity everywhere else.
withFlex/withSpacing are the plain-method form of those extensions; both give back this node's own type.
Attributes
- Supertypes
- Known subtypes
Children laid left to right at their natural widths, wrapping onto a new line when the next one does not fit — tags, chips, a bar of buttons. Widths are each child's Element.intrinsicWidth, so text is measured in display columns and a CJK label takes two per character; a .length(n) on a child fixes its width. A child that cannot say how wide it is takes a line of its own. gap blank columns separate neighbours and rowGap blank rows separate lines.
Children laid left to right at their natural widths, wrapping onto a new line when the next one does not fit — tags, chips, a bar of buttons. Widths are each child's Element.intrinsicWidth, so text is measured in display columns and a CJK label takes two per character; a .length(n) on a child fixes its width. A child that cannot say how wide it is takes a line of its own. gap blank columns separate neighbours and rowGap blank rows separate lines.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait Elementclass Objecttrait Matchableclass AnyShow all
One tab stop for a set of controls — a toolbar, a row of radio-like buttons, a menu bar — with the arrow keys moving between them (a roving tab stop). Tab enters the group on the member it was last left on (the first one, the first time), Right/Down and Left/Up cycle through the members, wrapping, and the next Tab leaves to the next stop after the group. A member that wants an arrow for itself — a slider, a list — still gets it first: the arrows only move focus when the focused member declined them.
One tab stop for a set of controls — a toolbar, a row of radio-like buttons, a menu bar — with the arrow keys moving between them (a roving tab stop). Tab enters the group on the member it was last left on (the first one, the first time), Right/Down and Left/Up cycle through the members, wrapping, and the next Tab leaves to the next stop after the group. A member that wants an arrow for itself — a slider, a list — still gets it first: the arrows only move focus when the focused member declined them.
Laid out as its content, which focusGroup(children*) makes a row; pass a single column(...) for a vertical group. Membership is every focusable in the subtree, at any depth, except those inside a nested group, which is a stop of its own. A disabled member is skipped like any disabled control.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait Elementclass Objecttrait Matchableclass AnyShow all
The focus bookkeeping the framework writes and an application only reads.
The focus bookkeeping the framework writes and an application only reads.
focused marks the one element keystrokes go to; inert marks a subtree a modal layer covers, which takes no key and no mouse event at all and supplies neither a focus path nor a hit-test path; focusStyle is the theme's focus cue, resolved once per render and stamped on every node rather than only the focused one — a list draws its selected row in it whether or not the keyboard is currently there, so reading it unconditionally is correct. The default here is the widget-level reverse, which is what a tree that no focus pass has run over renders with.
hovered is true on the one input target the pointer was last over — the node a mouse hit resolves to, so a container is hovered only where none of its children is — and is only ever written on a host that receives MouseEventKind.Moved, which takes mouse-motion tracking (RunnerConfig.withMouse(MouseCaptureMode.AllMotion); a TuiApp turns it on by itself once a frame contains a node with a hover or pressed style or an explicit .pointer). pressed is true on the target a button went down on, from that press until the matching release wherever it lands. disabled is the effective flag .disabled(true) sets on a node and every node under it: the node leaves the tab order, its handlers and built-ins are not run, and it draws in disabledStyle — the theme's disabled style, stamped on every node the way focusStyle is.
component is the StateStyles the theme holds for this node's role — its .variant(...), or the role the node type declares (button is ButtonRole.Default) — and theme the theme the pass resolved it from, which a node with further named parts (a list's "list.selected" row) reads its other lookups from. Both are stamped by the focus pass on every frame, so a theme change reaches the next frame without the view being rebuilt; a tree no focus pass has run over draws with StateStyles.Empty, exactly as it did before component styles existed.
The constructor is package-private on purpose. FocusPass rewrites this on every render and EventRouter honours what it finds, so an application able to build one could hand itself focus that the router would then respect. There is no supported way to construct one outside the framework.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
Renders a FormState as labeled controls with inline validation errors, composed from input/checkbox so it inherits focus traversal for free.
Live state for a derived form. Submission first parses all controls with the spec's original parsers. If parsing succeeds, typed field checks validate the candidate without changing it; only a valid candidate is published. Parser errors therefore precede validation errors. Writes and callbacks run on the render thread.
Live state for a derived form. Submission first parses all controls with the spec's original parsers. If parsing succeeds, typed field checks validate the candidate without changing it; only a valid candidate is published. Parser errors therefore precede validation errors. Writes and callbacks run on the render thread.
Versioned: version is the sum of every text field's input version plus the number of submits, so text typed into a field from outside the event path, or a submit made between frames, schedules the frame that shows it. The checkbox and choice fields are signals, which schedule their own frames.
A field can be disabled by name (disable, enable, setDisabled): both renderings draw it with the theme's disabled style and take it out of the tab order, and Form.accessible announces it as disabled. Its value is kept and still submitted — the case class needs every field — so disabling is a statement about editing, not about the result.
Attributes
- Companion
- object
- Supertypes
-
trait Versionedclass Objecttrait Matchableclass Any
Attributes
- Companion
- class
- Supertypes
-
trait Producttrait Mirrorclass Objecttrait Matchableclass Any
- Self type
-
FrameworkKeys.type
The keys TuiApp reserves for itself once nothing else claimed an event, and the PageUp/PageDown step of every scrollable — each key under a BindingId, so a user keymap moves them the way it moves an app's own bindings.
The keys TuiApp reserves for itself once nothing else claimed an event, and the PageUp/PageDown step of every scrollable — each key under a BindingId, so a user keymap moves them the way it moves an app's own bindings.
A framework key fires when the pressed key is the same key holding at least the declared modifiers, so the default ctrl+p also answers to Ctrl+Alt+P, as it always has. The keys TuiApp handles itself — focus traversal, the command palette, quit, close-modal, the inspector and copy-selection — may be sequences (ctrl+x ctrl+c): they take part in the same pending-prefix dispatch as the app's bindings, after them, so an app binding that shares a prefix wins. menu-bar, window-move and window-resize are read by an element while it handles one key, so each stays a single key. KeySequence.unbound takes a key away (see unbind). Rebinding quit moves the Ctrl+C key event; a terminal that delivers Ctrl+C as SIGINT still quits through onInterrupt.
An immutable value; TuiApp.frameworkKeys is read on the render thread for every key that reaches this stage.
Attributes
- Companion
- object
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
A one-row filled bar with a caption over it; the caption defaults to the percentage.
A one-row filled bar with a caption over it; the caption defaults to the percentage.
The caption trio and the two fill ramps come from ProgressMeterBuilders, shared with ProgressBarElement, so the two progress meters are captioned and colored the same way whichever one a view reaches for. trackStyle and fillStyle come from the same LoadingTheme the whole progress-and-spinner family draws from, so a gauge and a progressBar side by side are the same two colours.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait Elementclass Objecttrait Matchableclass AnyShow all
Children placed on a two-axis grid of column and row tracks — a dashboard of cards that does not reflow when one card's content changes width.
Children placed on a two-axis grid of column and row tracks — a dashboard of cards that does not reflow when one card's content changes width.
The tracks are ordinary io.worxbend.tui.core.Constraints solved by the same solver row and column use, with columnGap / rowGap blank cells between neighbouring tracks; an Auto track is sized by the children sitting in that track alone. A child says where it goes with .at(row, col), how many tracks it covers with .span(rows, cols), or which named area of an .areas(...) template it fills with .area(name); a child that says nothing is auto-flowed into the next free run of cells, in reading order (see io.worxbend.tui.core.GridLayout.autoFlow). A child placed past the last track is clipped to the tracks there are, or not drawn at all when it starts outside them.
A child's own .length / .fill means nothing here — the tracks decide every size — so it is ignored.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait Elementclass Objecttrait Matchableclass AnyShow all
Where a child of a grid asked to sit — written by .at(row, col), .span(rows, cols) and .area(name), read only by the grid that contains it.
Where a child of a grid asked to sit — written by .at(row, col), .span(rows, cols) and .area(name), read only by the grid that contains it.
position fixes the top-left cell; area names a cell of the grid's .areas(...) template and wins over position; with neither, the grid's auto-flow picks the next free run of cells that fits the spans.
Attributes
- Companion
- object
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
One block of the help overlay: the hints of the bindings that belong to mode, or of the mode-less ones when mode is None. See KeyBindings.helpSections.
One block of the help overlay: the hints of the bindings that belong to mode, or of the mode-less ones when mode is None. See KeyBindings.helpSections.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
A scrollable hex dump of bytes over a caller-owned w.HexViewerState. While focused, Left/Right move the selected byte by one, Up/Down by a row, PageUp/PageDown by ten rows and Home/End to either end; the wheel moves a row on hover. The view scrolls to keep the selection on screen, and the selected byte wears the focus style in both the hex and the ASCII column.
A scrollable hex dump of bytes over a caller-owned w.HexViewerState. While focused, Left/Right move the selected byte by one, Up/Down by a row, PageUp/PageDown by ten rows and Home/End to either end; the wheel moves a row on hover. The view scrolls to keep the selection on screen, and the selected byte wears the focus style in both the hex and the ASCII column.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait Elementclass Objecttrait Matchableclass AnyShow all
A one-row indeterminate progress bar, themed at construction.
A one-row indeterminate progress bar, themed at construction.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait Elementclass Objecttrait Matchableclass AnyShow all
Single-line text input. Editing state (value + cursor) is app-owned; editing keys are handled by the built-in handler while focused, and any consumed key triggers a redraw.
Single-line text input. Editing state (value + cursor) is app-owned; editing keys are handled by the built-in handler while focused, and any consumed key triggers a redraw.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait Elementclass Objecttrait Matchableclass AnyShow all
The text-entry fields — textInput, passwordInput, textArea and the like — under "input".
The text-entry fields — textInput, passwordInput, textArea and the like — under "input".
Attributes
- Supertypes
-
trait Singletontrait Producttrait Mirrortrait Serializabletrait Producttrait Equalstrait ComponentRoleclass Objecttrait Matchableclass AnyShow all
- Self type
-
InputRole.type
A tree view of a described value — see w.Inspect. Claims exactly the rows its tree measures, so it stacks in a column like text; put it in a scrollView when the value is taller than the screen.
A tree view of a described value — see w.Inspect. Claims exactly the rows its tree measures, so it stacks in a column like text; put it in a scrollView when the value is taller than the screen.
Read-only without a state. With one it is focusable and collapsible: Up/Down (Home/End) move the selected row, Enter or Space folds or unfolds it, Right unfolds, Left folds — or, on a row that is already folded or cannot fold, moves to the parent — and a click selects the row under the pointer and folds or unfolds it.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait Elementclass Objecttrait Matchableclass AnyShow all
Appearance for a custom leaf, rebuilt from the current focus pass on each frame.
Appearance for a custom leaf, rebuilt from the current focus pass on each frame.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
Default behavior for a caller-owned state. User handlers run first; false leaves the event unconsumed. Mouse bounds are translated, unclipped layout bounds in the event's coordinate space. The router has already checked the pointer against every enclosing viewport and the host boundary for the press. A press onMouse consumes captures the pointer: the drags and the release that follow arrive here with the press-time bounds even after the pointer has left them, so clamp positions rather than assuming they are inside. MouseEvent.clickCount tells a double click.
Default behavior for a caller-owned state. User handlers run first; false leaves the event unconsumed. Mouse bounds are translated, unclipped layout bounds in the event's coordinate space. The router has already checked the pointer against every enclosing viewport and the host boundary for the press. A press onMouse consumes captures the pointer: the drags and the release that follow arrive here with the press-time bounds even after the pointer has left them, so clamp positions rather than assuming they are inside. MouseEvent.clickCount tells a double click.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
An immutable adapter over Widget/Measured. State and resource lifetime remain the caller's responsibility. build must be side-effect-free: measurement can request a widget before painting. Return a widget that mixes in Measured to use the same sizing contract as built-in leaves. It is never wrapped in a measurement-erasing lambda.
An immutable adapter over Widget/Measured. State and resource lifetime remain the caller's responsibility. build must be side-effect-free: measurement can request a widget before painting. Return a widget that mixes in Measured to use the same sizing contract as built-in leaves. It is never wrapped in a measurement-erasing lambda.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait Elementclass Objecttrait Matchableclass AnyShow all
Named key constants and constructors, so handlers read onKey(Key.Up){ … } instead of matching raw KeyEvent(KeyCode.Up, _). Mirrors terminus's Key.up / Key.controlQ vocabulary.
Named key constants and constructors, so handlers read onKey(Key.Up){ … } instead of matching raw KeyEvent(KeyCode.Up, _). Mirrors terminus's Key.up / Key.controlQ vocabulary.
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
Key.type
One declared application key: the key sequences that fire it, the short label shown in status-bar hints, a description for the help overlay, and the action.
One declared application key: the key sequences that fire it, the short label shown in status-bar hints, a description for the help overlay, and the action.
triggers is a sequence because one command often answers to several keys — a vim-flavoured app wants j and down to mean the same thing. Declaring the action twice would work for dispatch but would double it everywhere else: two hints in the status bar, two rows in the help overlay, two identical entries in the command palette. label is chosen rather than derived from triggers, so the app decides which of them the user is shown.
Each trigger is a KeySequence; a single key is a one-step sequence. explicitId is the BindingId a keymap rebinds this binding by when the default — the slugged description — will not do (see id). mode is the Mode the binding belongs to, None for one that is live in every mode.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
The application's declared keys (bubbles' key+help pattern): one declaration drives dispatch, the status-bar hints, and the help overlay. TuiApp consults these for events no element consumed.
The application's declared keys (bubbles' key+help pattern): one declaration drives dispatch, the status-bar hints, and the help overlay. TuiApp consults these for events no element consumed.
Bindings may be key sequences, and may belong to Modes (see KeyBindings.modes). Construction rejects a sequence that is a strict prefix of another binding live in the same mode — "g" next to "g g" — because the shorter one could only ever fire by timing out the longer one, which is a guess rather than a binding.
A value: TuiApp hands the chrome a copy tagged with the current mode and the pending prefix (mode, pending) so statusBar(activeBindings) can show both. Build it on any thread; handle/dispatch run the bound actions on the calling thread, which for TuiApp is the render thread.
Attributes
- Companion
- object
- Supertypes
-
class Objecttrait Matchableclass Any
Attributes
- Companion
- class
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
KeyBindings.type
One row of key help: the keys as the user types them — "ctrl+s", or the rest of a sequence after a typed prefix — and what they do. Rows of the which-key popup and the help overlay.
One row of key help: the keys as the user types them — "ctrl+s", or the rest of a sequence after a typed prefix — and what they do. Rows of the which-key popup and the help overlay.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
The key `` stands for when bindings are built: the space bar, unless a given KeyLeader says otherwise — given KeyLeader = KeyLeader(",") inside the app object, before its bindings.
The key `` stands for when bindings are built: the space bar, unless a given KeyLeader says otherwise — given KeyLeader = KeyLeader(",") inside the app object, before its bindings.
Attributes
- Companion
- object
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
What one key did to a KeyBindings dispatch: fired a binding, extended a pending prefix (the keys pressed so far, which some binding's sequence continues), or matched nothing at all.
What one key did to a KeyBindings dispatch: fired a binding, extended a pending prefix (the keys pressed so far, which some binding's sequence continues), or matched nothing at all.
Attributes
- Supertypes
-
trait Enumtrait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
Attributes
- Companion
- class
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
KeySequence.type
The keys a binding answers to, pressed one after another: "g g", "ctrl+k ctrl+s", " f". A single-key spec is a one-step sequence, so every binding is a sequence and the single-key case needs no separate path.
The keys a binding answers to, pressed one after another: "g g", "ctrl+k ctrl+s", " f". A single-key spec is a one-step sequence, so every binding is a sequence and the single-key case needs no separate path.
Equality is over steps only. spelling is how the sequence was written — kept because it is what hints, the help overlay and the keymap export show the user, and a KeyEvent does not remember its own text — so "esc" and "escape" are the same sequence spelled two ways.
An immutable value, safe to share between threads.
Attributes
- Companion
- object
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
The implementation behind keyseq"…". Public only because an inline method's body is expanded in the calling module; it is not an API.
The implementation behind keyseq"…". Public only because an inline method's body is expanded in the calling module; it is not an API.
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
KeySequenceLiteral.type
One step of a KeySequence: a concrete key, or the placeholder `` that the owning KeyBindings resolves to its configured leader key (see KeyBindings.withLeader).
One step of a KeySequence: a concrete key, or the placeholder `` that the owning KeyBindings resolves to its configured leader key (see KeyBindings.withLeader).
Attributes
- Supertypes
-
trait Enumtrait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
User keymaps: a plain-text file of id = spec lines read into the Map[BindingId, KeySequence] that KeyBindings.rebind and FrameworkKeys.rebind take, and a Markdown export of the keys an app ends up with.
User keymaps: a plain-text file of id = spec lines read into the Map[BindingId, KeySequence] that KeyBindings.rebind and FrameworkKeys.rebind take, and a Markdown export of the keys an app ends up with.
# ~/.config/myapp/keys
save = ctrl+s
go-to-top = g g
quit = ctrl+q
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
Keymap.type
One framework key as FrameworkKeys.entries lists it: the id a keymap rebinds it by, the key it is bound to now and what it does.
One framework key as FrameworkKeys.entries lists it: the id a keymap rebinds it by, the key it is bound to now and what it does.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
How a node a themed factory built outside a view — against the ambient Theme.default — picks up the app's own theme when it is painted.
How a node a themed factory built outside a view — against the ambient Theme.default — picks up the app's own theme when it is painted.
A themed factory used to copy theme.border and friends into the node it built, once, at construction. Inside a view that is the app's theme, because View hands it in; but an element built by a top-level def or a helper object saw only Theme.default, and an app running Theme.Light painted that panel in dark-theme colours without a word. The factory now also records how it built the node — the function from a theme to the node — and the focus pass, which already rebuilds every node each frame and knows the app's theme, calls rebound on it.
Rebinding is field by field, so builders applied after the factory are kept: a field still equal to what the factory produced under the default theme is theme-owned and takes the app theme's value; a Style field the caller changed is rebased — the caller's own changes (an added bold, a new foreground) are layered over the app theme's value rather than over the default's; any other field the caller changed is kept as it is. The node's ElementProps are merged the same way.
A factory handed an explicit theme (panel(...)(using Theme.HighContrast), or any element built inside a view) is pinned to it and never rebound: the theme it was given is the decision. Only the ambient default is late-bound.
Built on scala.deriving.Mirror — compile-time derivation, no runtime reflection — so it stays native-image safe. Render-thread only, like the focus pass that calls it.
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
Z-ordered stacking: every child renders over the full area in order, so later children paint over earlier ones — the primitive under dialogs, toasts, palettes, and splash overlays.
Z-ordered stacking: every child renders over the full area in order, so later children paint over earlier ones — the primitive under dialogs, toasts, palettes, and splash overlays.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait Elementclass Objecttrait Matchableclass AnyShow all
A virtual list of count items, each itemHeight rows tall, that builds, decorates and paints only the items the viewport shows — plus one either side — however large count is.
A virtual list of count items, each itemHeight rows tall, that builds, decorates and paints only the items the viewport shows — plus one either side — however large count is.
The items are built during the frame's resolution pass, not at the factory call, because which items are visible is a question about the frame: the pass asks the caller-owned w.LazyListState for its build window (the last frame's viewport, re-anchored on the current offset and selection; the frame's height before the first render) and calls build for exactly those indices. What it builds is then an ordinary part of the tree: focusables in it take Tab stops, keys bubble out of it, the bounds recorder sees it, a focused text field in it drives the caret. An item that falls outside the window between frames — the enclosing scroll view jumped a page — is left blank for that paint. The miss asks the host for the frame that builds and decorates it with its normal hook identity; painting never invents a second, inert component lifetime.
While focused, Up/Down move the selection, Home/End jump to the ends and PageUp/PageDown move a page; the wheel moves the selection on hover, and a press selects the item under the pointer. The selected item is drawn in the same highlight a list uses.
Focus follows a keyed item (.key(...)) across frames as the window moves; an unkeyed focusable inside an item is identified by its tab position, which shifts as items scroll in and out — key anything focusable.
Drawn with no host behind it (a construction test rendering widget straight into a buffer), the node builds each visible item at render time instead; with no focus pass behind that, focusables in it are inert.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait Elementclass Objecttrait Matchableclass AnyShow all
One terminal row of differently-styled runs — the mixed-style counterpart of TextElement.
One terminal row of differently-styled runs — the mixed-style counterpart of TextElement.
text(...) paints a whole block in one style, which cannot say "Status: " in the default colour and "OK" in green. Before this node the way to get that was row(text("Status: ").length(8), text("OK").fg(Color.Green)), i.e. a hand counted display width in the source — wrong the moment the label is translated, and wrong today for any CJK or emoji text, where one character is two columns. Here the widths are measured, not declared.
The element's own style is carried on the Line as its base layer and resolved by the renderer, so line(...).dim dims the whole row while a span that set its own colour keeps it.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait Elementclass Objecttrait Matchableclass AnyShow all
Why a line-based text file — a theme file (Theme.parse), a keymap (Keymap.parse) — could not be read: the 1-based line it went wrong on and what was wrong there. Prints as line 4: ….
Why a line-based text file — a theme file (Theme.parse), a keymap (Keymap.parse) — could not be read: the 1-based line it went wrong on and what was wrong there. Prints as line 4: ….
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
A head travelling a one-cell track, themed at construction.
A head travelling a one-cell track, themed at construction.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait Elementclass Objecttrait Matchableclass AnyShow all
A scrollable single-selection list. Up/Down move the selection while focused, the wheel does the same on hover; the widget scrolls to keep the selection visible. state is caller-owned, so the app can read or set the selection.
A scrollable single-selection list. Up/Down move the selection while focused, the wheel does the same on hover; the widget scrolls to keep the selection visible. state is caller-owned, so the app can read or set the selection.
direction says which edge the rows are anchored to — call bottomToTop for the chat-transcript shape.
An item is a plain String, a styled Line, or a whole Text, and the three may be mixed in one list — the same union w.ListView itself accepts. A plain string is the common case and needs no ceremony; a Line is how a single row carries its own colour (a red failure, a dimmed disabled entry) or several styles at once; a Text is how one item takes several rows, a title with a dimmed subtitle under it being the usual reason. Selection and the keyboard moves count items, not rows, so one press of Down still moves past a whole multi-row item.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait Elementclass Objecttrait Matchableclass AnyShow all
The scrollable "pick a row" collections under "list"; ListRole.Selected is the selected row's highlight, which falls back to the theme's focus cue when the theme leaves it silent.
The scrollable "pick a row" collections under "list"; ListRole.Selected is the selected row's highlight, which falls back to the theme's focus cue when the theme leaves it silent.
Attributes
- Supertypes
-
trait Singletontrait Producttrait Mirrortrait Serializabletrait Producttrait Equalstrait ComponentRoleclass Objecttrait Matchableclass AnyShow all
- Self type
-
ListRole.type
The value of a useTask: still running, finished with a value, or failed.
The value of a useTask: still running, finished with a value, or failed.
Loading is also the answer on a host with no render loop to deliver a result to — a Console.print or a Snapshot.render — because there the task is never started.
Attributes
- Supertypes
-
trait Enumtrait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
Attributes
- Companion
- class
- Supertypes
-
trait Producttrait Mirrorclass Objecttrait Matchableclass Any
- Self type
-
LoadingTheme.type
The styles the loading and progress animations draw from.
The styles the loading and progress animations draw from.
Split out of Theme rather than flattened into it because these five travel together: retheming a progress bar means changing track and fill consistently, and a theme that got one of them wrong would be hard to spot. It also keeps Theme's own vocabulary semantic (accent, muted) rather than widget-specific.
fillRamp is optional because a color ramp is a deliberate choice, not a default: a bar that walks red-to-green reads as "danger receding", which is right for disk usage and wrong for a download. Themes leave it unset and a call site opts in with .ramp(...).
Attributes
- Companion
- object
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
Attributes
- Companion
- class
- Supertypes
-
trait Producttrait Mirrorclass Objecttrait Matchableclass Any
- Self type
-
LogConsoleElement.type
The tail of a LogRing, one record per row, filtered by level and logger prefix and drawn through the Log widget — the console an app shows when the user presses the key it bound for it.
The tail of a LogRing, one record per row, filtered by level and logger prefix and drawn through the Log widget — the console an app shows when the user presses the key it bound for it.
Each row is HH:mm:ss LEVEL logger message, the time and logger in the theme's muted, the level in warning or error for those two severities, and a record's throwable appended as (Class: message) — the class and message, never the stack trace, which belongs in a file. Built with logConsole(ring) the console always follows the tail: it shows the newest records that fit and has no scroll state to own. Built with logConsole(ring, state) it scrolls through a caller-owned LogConsoleState — focusable, Up/Down/PageUp/PageDown and the wheel scroll, Home jumps to the oldest record and End follows the tail again. Either way a view may build one per frame. The ring is read once per render, as a snapshot, and it is thread-safe, so records appended from a worker thread show up on the next frame without any marshalling — a frame that must happen because a record arrived is still the app's to request.
.minLevel(level) hides everything below level; .loggerPrefix("app.net") keeps records from that logger and its children (the prefix is matched at a . boundary, so app does not match apple); .zone(zone) chooses the zone the timestamp is rendered in, the system default unless said otherwise.
Attributes
Caller-owned scroll state for logConsole(ring, state): where the console's window sits over the filtered records, and whether it follows the tail.
Caller-owned scroll state for logConsole(ring, state): where the console's window sits over the filtered records, and whether it follows the tail.
Following (the default) pins the window to the newest records, as the stateless console always does. Scrolling up detaches it, and the window then stays on the records it shows while new ones arrive below; scrolling back down to the end — or followTail, or End on a focused console — re-attaches it. toggleFollow flips following by hand, for a key the app binds itself. The window is a row index into the filtered records, so a ring at capacity that evicts its oldest record shifts a detached window by that one row.
Render-thread-only. Every mutation raises version, so the node that paints this state schedules the frame that shows a change made outside the event path. Rendering reads the last viewport into it without counting as one.
Attributes
- Supertypes
-
trait VersionedStatetrait Versionedclass Objecttrait Matchableclass Any
A scrollable log panel: Up/Down (and PageUp/PageDown) scroll while focused; the tail re-follows when scrolled back to the bottom.
A scrollable log panel: Up/Down (and PageUp/PageDown) scroll while focused; the tail re-follows when scrolled back to the bottom.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait Elementclass Objecttrait Matchableclass AnyShow all
Markdown that is still arriving — an LLM's reply, token by token — drawn from a caller-owned w.MarkdownStream.
Markdown that is still arriving — an LLM's reply, token by token — drawn from a caller-owned w.MarkdownStream.
Without a follow state this is a measured leaf like markdown(…): it reports its wrapped height, so it sizes correctly in a column or inside a scrollView — and inside one it keeps the view pinned to its newest row through the scroll view's reveal requests: when the view was at its end as a frame began, it asks to show the stream's last row, so scrollView(markdownStream(stream), scroll) follows the tail, holds still once the reader scrolls up, and follows again after End. With one (markdownStream(stream, scroll)) the node is its own scroll view over the document, pinned to the newest row while content arrives: each frame it measures the document, and if the view's offset was still at the bottom the frame before, moves it to the new bottom. Scrolling up (Up, PageUp, Home, the wheel) leaves the bottom and the view holds still while text keeps arriving; End, or scrolling back down, rejoins the tail. That decision lives here rather than in scrollView, so a plain scroll view keeps its offset exactly where the user left it.
The stream is render-thread-only and appending does not schedule a frame: append from a render-thread callback (an Async continuation, a binding) and pair it with a Signal write or TuiApp.requestRedraw(). One pinned view per stream — the follow bookkeeping is kept on the stream.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait Elementclass Objecttrait Matchableclass AnyShow all
Scrolling ticker text: one row, travelling leftwards, wrapping round with a run of blanks between repetitions.
Scrolling ticker text: one row, travelling leftwards, wrapping round with a run of blanks between repetitions.
The speed is a reading rate — cells per second — not a step per tick, so the same ticker reads at the same pace whatever the app's tickRate happens to be. Around eight cells per second is comfortable. period says the same thing from the other end, as the time one full lap takes, which is the vocabulary the rest of this file's animated nodes (SkeletonElement, LinearSpinnerElement, IndeterminateElement) already use.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait Elementclass Objecttrait Matchableclass AnyShow all
A one-row menu bar over w.MenuBar with drop-downs drawn by the existing w.Menu through the frame root, over everything else. Alt+ opens a menu and the menu-bar framework key (F10) opens the first, whatever holds focus; while a menu is open Left/Right move to the neighbouring menu, Up/Down move the highlight, Enter runs the item through onSelect(menu, item) and closes the bar, Esc closes it. A click on a title opens or closes that menu, a click on an item runs it, a click anywhere else closes the bar.
A one-row menu bar over w.MenuBar with drop-downs drawn by the existing w.Menu through the frame root, over everything else. Alt+ opens a menu and the menu-bar framework key (F10) opens the first, whatever holds focus; while a menu is open Left/Right move to the neighbouring menu, Up/Down move the highlight, Enter runs the item through onSelect(menu, item) and closes the bar, Esc closes it. A click on a title opens or closes that menu, a click on an item runs it, a click anywhere else closes the bar.
The bar is not a tab stop: like the menu bars it imitates, it is reached by its keys and the pointer, and takes the keyboard only while a menu is open (it swallows plain typing then, so letters do not leak into the control underneath). Those keys are taken ahead of the focused control, with one exception that keeps both usable: while a text field holds focus and the bar is closed, the field's own Alt+B/Alt+D/Alt+F/Alt+Y chords (TextEntryAltChords) reach the field rather than a menu with that mnemonic. F10 (the rebindable menu-bar key) opens the bar whatever holds focus, and with the bar open a mnemonic letter — plain or with Alt — moves to its menu; so F10 then F opens File from inside a field.
floating is the framework's slot for the decorated scrim and drop-down; application code never sets it.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait Elementclass Objecttrait Matchableclass AnyShow all
A vertical menu / dropdown / context menu popup. Up/Down move the highlight (skipping separators and disabled items), Enter (or a click) fires onSelect with the chosen index, the wheel scrolls. Escape is left unconsumed so an enclosing app can close it.
A vertical menu / dropdown / context menu popup. Up/Down move the highlight (skipping separators and disabled items), Enter (or a click) fires onSelect with the chosen index, the wheel scrolls. Escape is left unconsumed so an enclosing app can close it.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait Elementclass Objecttrait Matchableclass AnyShow all
Every word and marker the framework draws on its own, in one table an application can translate.
Every word and marker the framework draws on its own, in one table an application can translate.
A dialog's default button, the command palette's title and filter placeholder, the help overlay's heading, the wizard's Back/Next/Finish, the inspector's panel titles, and the prompts' yes/no hints, list hints, pointer and check glyphs — none of these are written by the application, so before this table an app shipped in Spanish still said "OK" and "type to filter…". Each built-in reads its label from the table in force when it is built or painted, never from a literal.
An application sets the table with override def messages: Messages = Messages.Default.withDialogOk("Sí") on its TuiApp; the run binds it on the render thread around every frame and every event, so a factory called in view and an overlay painted after it read the same table. Code that builds elements outside a run — a Snapshot, Console.print, a Prompt — reads Default unless it is wrapped in Messages.scoped.
Labels the application passes explicitly (dialog(title, message, buttons = Seq("Vale"))) are never touched: the table only supplies the defaults. Strings are plain values with no placeholders except where a field's Scaladoc names one ({lines} in composerPasted, {input}, {min}, {max}, {yes}, {no} and {options} in the prompt validation messages). Immutable; safe to share between threads.
Value parameters
- composerPasted
-
the placeholder
promptComposerinserts for a multi-line paste;{lines}is replaced by the line count. - composerReverseSearch
-
the label of
promptComposer's Ctrl+R history search bar. - dialogCancel
-
the second, cancelling button of
Screen.confirm. - dialogOk
-
the single button
dialog(...)draws when given none, and the confirming button ofScreen.confirm. - frameworkKeyDescriptions
-
what
FrameworkKeys.entries(and soKeymap.markdown) says each framework key does, by its BindingId; an id left out is described by its id. Set one with withFrameworkKeyDescription. - helpTitle
-
the title of
helpOverlay(...)when none is passed. - iconSuccess
-
the marker a success
noticeand toast draw before their message. iconInfo, iconWarning and iconError are the other three severities'; set any with withIcon. - inspectorNothing
-
what the inspector's card says when nothing is focused or under the pointer.
- inspectorTitle
-
the title of the inspector's node card (F12).
- inspectorTreeTitle
-
the title of the inspector's element-tree panel.
- palettePlaceholder
-
the command palette's filter-input placeholder.
- paletteTitle
-
the title of the command palette (Ctrl+P).
- promptAnswerYesNo
-
a typed confirm answer that is neither yes nor no;
{yes}/{no}are promptYes/promptNo,{input}the answer. - promptCancelled
-
what a cancelled prompt step leaves instead of an answer.
- promptChecked
-
the marker of a chosen row in a multi-choice prompt, including its trailing space.
- promptChooseAtLeast
-
a
Prompt.multiSelectanswer with fewer thanminchoices;{min}is the minimum. - promptCommaSeparated
-
the plain multi-select hint describing its answer separator.
- promptMultiSelectHint
-
the hint beside a multi-choice prompt.
- promptNo
-
how a confirm prompt's summary line shows a no.
- promptNotANumber
-
a
Prompt.numberanswer that is not a whole number;{input}is the answer. - promptNotAnOption
-
a typed choice answer naming no option;
{input}is the word,{options}the option labels joined by,. - promptNothingToChoose
-
a choice prompt answered with no options to choose from.
- promptNumberRange
-
a
Prompt.numberanswer outside its bounds;{min}and{max}are the bounds. - promptPathMissing
-
a
Prompt.path(mustExist = true)answer naming nothing;{input}is the answer. - promptPathRequired
-
an empty
Prompt.pathanswer. - promptPointer
-
the marker before a choice prompt's highlighted row, including its trailing space.
- promptRequired
-
the validation message of a required text prompt left empty.
- promptSecretRejected
-
a rejected password's diagnostic, replacing validator text that may contain the secret.
- promptSelectHint
-
the hint beside a single-choice prompt.
- promptUnchecked
-
the marker of an unchosen row in a multi-choice prompt, including its trailing space.
- promptYes
-
how a confirm prompt's summary line shows a yes.
- promptYesNoDefaultNo
-
the hint beside a confirm prompt whose Enter means no.
- promptYesNoDefaultYes
-
the hint beside a confirm prompt whose Enter means yes.
- searchPlaceholder
-
the placeholder
searchBar(state)shows when given none. - tagSuccess
-
the short tag
badge(NoticeLevel.Success)reads. tagInfo, tagWarning and tagError are the other three severities'; set any with withTag. - taskFailed
-
the marker before a failed
Prompt.taskline. - taskSucceeded
-
the marker before a finished
Prompt.taskline. - whichKeyEllipsis
-
the marker after a half-typed key sequence — the which-key popup's title and the pending
statusBar(bindings)hint,ctrl+k …. - wizardBack
-
the wizard's previous-step button.
- wizardFinish
-
the wizard's next-step button on the last step.
- wizardNext
-
the wizard's next-step button.
Attributes
- Companion
- object
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
A named set of bindings that are live only while AppServices.keyMode holds id — see KeyBindings.modes.
A named set of bindings that are live only while AppServices.keyMode holds id — see KeyBindings.modes.
Attributes
- Companion
- object
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
The name of one key mode — normal, insert — as declared by Mode and published by AppServices.keyMode.
Attributes
- Companion
- class
- Supertypes
-
trait Producttrait Mirrorclass Objecttrait Matchableclass Any
- Self type
-
MouseContext.type
One mouse event as an element's onMouse handler sees it: the event itself (absolute position, kind, button, modifiers and the synthesised clickCount), the position relative to the element's own top-left cell, and the element's translated layout area.
One mouse event as an element's onMouse handler sees it: the event itself (absolute position, kind, button, modifiers and the synthesised clickCount), the position relative to the element's own top-left cell, and the element's translated layout area.
local is event.position minus area's origin, so (0, 0) is the element's top-left cell whatever moves it on screen. While a press on the element has captured the pointer, drags and the release keep arriving here even once the pointer has left the element, so local can be negative or past area's size — clamp it the way a slider does.
Attributes
- Companion
- object
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
Multi-task progress: one row per caller-owned w.ProgressTask, each row the same w.ProgressColumns, themed at construction from the LoadingTheme. The tasks are watched, so a background task.advance(n) posted back to the render thread repaints without a signal; while any task is still running the node also asks for animation ticks so a spinner column turns and the elapsed and ETA columns count.
Multi-task progress: one row per caller-owned w.ProgressTask, each row the same w.ProgressColumns, themed at construction from the LoadingTheme. The tasks are watched, so a background task.advance(n) posted back to the render thread repaints without a signal; while any task is still running the node also asks for animation ticks so a spinner column turns and the elapsed and ETA columns count.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait Elementclass Objecttrait Matchableclass AnyShow all
One styled message line, themed at construction.
One styled message line, themed at construction.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait Elementclass Objecttrait Matchableclass AnyShow all
One application's toast stack, as a value that can be passed around.
One application's toast stack, as a value that can be passed around.
TuiApp.notify is a protected method on the app, so only code written inside the app's own body can raise a toast. A helper function or an element factory living in another file — the shape most applications reach for as soon as a view grows past one screen — had to be handed a callback by the app to say anything to the user.
This is the same capability expressed as a value. Take it as a using parameter and any helper anywhere can notify:
def saveRow(row: Row)(using notifications: Notifications): Unit =
repository.save(row)
notifications.success(s"saved ${row.name}")
Ownership and threads: an instance is bound to one TuiApp and, like everything else that writes a Signal, must be called on that app's render thread — which every event handler, timer body and Async continuation already is. A toast ages out on its own: the run keeps its ambient tick going for as long as a toast is live, so neither a config.tickRate nor an ambient animation is needed for one to disappear.
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Known subtypes
-
trait AppServices
Which characters a NumberInputElement accepts: whole numbers only, or a single decimal point as well.
Which characters a NumberInputElement accepts: whole numbers only, or a single decimal point as well.
Attributes
- Supertypes
-
trait Enumtrait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
A text input restricted to numbers: an optional single leading minus and, in NumberFormat.Decimal, one dot.
A text input restricted to numbers: an optional single leading minus and, in NumberFormat.Decimal, one dot.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait Elementclass Objecttrait Matchableclass AnyShow all
An orbit spinner whose colors were resolved from the ambient Theme at construction.
An orbit spinner whose colors were resolved from the ambient Theme at construction.
The LoadingTheme supplies both: the resting path takes track, the arc takes spinner. Anything the call site sets with .fg/.bold/.styled layers onto the arc only, so orbitSpinner().fg(Color.Red) recolors the moving part and leaves the path themed — the rule SpinnerElement follows for its glyph and label.
Everything about the figure itself — path, trail, sweep, radius, resolution, period — rides in the io.worxbend.tui.widgets.OrbitSpinnerOptions the node forwards to the widget, and the builders below each rewrite one field of it, so a knob added to the widget arrives here as one copy rather than as an eleventh constructor parameter.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait Elementclass Objecttrait Matchableclass AnyShow all
A page indicator: Left/Right change the page while focused.
A page indicator: Left/Right change the page while focused.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait Elementclass Objecttrait Matchableclass AnyShow all
A bordered box with an optional title, stacking its children vertically inside the border.
A bordered box with an optional title, stacking its children vertically inside the border.
Two captions are available, and neither costs a content row: title is written into the top border and titleBottom into the bottom border — the name-above / status-below shape most panes in a real application want. Each has its own alignment (left for the top one, right for the bottom one, unless .titleAligned / .titleBottomAligned say otherwise), and .titles(...) adds any number of further captions built as io.worxbend.tui.widgets.BlockTitles, which is how a caption made of differently-styled runs gets in — a BlockTitle carries a Line, and a Line carries spans.
borders chooses which sides are drawn. The default is all four, but a pane can be a horizontal rule above its content (Borders.Top), a column separated from its neighbour by a single line (Borders.Left), or unframed entirely (.borderless) while keeping the panel's padding and captions. Where two drawn sides meet, the block draws a corner glyph; where they do not, it does not, so a half-framed panel has no dangling corners.
padding reserves blank cells between the border and the children.
The children are stacked by the same w.Column a ColumnElement builds, so a panel is a FlexContainer too: .gap/.center/.spaceBetween work inside the border without wrapping the children in a column first.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait FlexContainertrait Elementclass Objecttrait Matchableclass AnyShow all
A prototyping stand-in: a dashed box with label centred in it and the size the layout actually gave it written underneath. Takes whatever room its container hands out, the way the panel it stands in for eventually will, so swapping it for the real content does not move anything around it.
A prototyping stand-in: a dashed box with label centred in it and the size the layout actually gave it written underneath. Takes whatever room its container hands out, the way the panel it stands in for eventually will, so swapping it for the real content does not move anything around it.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait Elementclass Objecttrait Matchableclass AnyShow all
Like PositionedElement, but the content escapes its container.
Like PositionedElement, but the content escapes its container.
Both nodes measure dx/dy from the top-left of the area the node itself occupies. The difference is what happens when the resulting rectangle runs past that area. A PositionedElement intersects with it, so a dropdown opened from a row inside a bordered panel loses everything past the border. This node instead hands the rectangle and the content to the frame root, which draws it after the whole tree — over the border, over any sibling pane, clipped only by the terminal.
Portals paint in the order they were rendered, all of them above the tree, and a portal inside portal content is drawn above the portal that contains it.
The content is still a child for event routing, focus order and measurement, so a menu inside a portal is clicked and tabbed to exactly where it is drawn.
There is one case with no frame root to hand the content to: rendering a bare Element outside a TuiApp, as a construction test that calls widget.render directly does. Rather than vanish, the content then falls back to PositionedElement's clipped in-place behaviour.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait Elementclass Objecttrait Matchableclass AnyShow all
Renders content at an absolute offset inside whatever area it is given, sized width x height (clipped to the area). The building block for context menus and tooltips anchored at a mouse or widget position — compose it over a base with Element.layers.
Renders content at an absolute offset inside whatever area it is given, sized width x height (clipped to the area). The building block for context menus and tooltips anchored at a mouse or widget position — compose it over a base with Element.layers.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait Elementclass Objecttrait Matchableclass AnyShow all
Where a TuiApp run that has no terminal prints, and at what size and colour depth — what TuiApp.printTarget answers when the process is non-interactive, and what a test overrides it with to capture the output.
Where a TuiApp run that has no terminal prints, and at what size and colour depth — what TuiApp.printTarget answers when the process is non-interactive, and what a test overrides it with to capture the output.
size is the frame the app composes (the terminal's size has nothing to say when there is no terminal), colors the depth PrintFinalFrame/PrintEveryFrame encode with (Plain ignores it), and write the sink — standard output in production, a StringBuilder in a test. write is called on the render thread, once per frame written.
Attributes
- Companion
- object
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
Attributes
- Companion
- class
- Supertypes
-
trait Producttrait Mirrorclass Objecttrait Matchableclass Any
- Self type
-
PrintTarget.type
A one-row determinate progress bar, themed at construction. The caption and fill-ramp builders come from ProgressMeterBuilders, shared with GaugeElement.
A one-row determinate progress bar, themed at construction. The caption and fill-ramp builders come from ProgressMeterBuilders, shared with GaugeElement.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait Elementclass Objecttrait Matchableclass AnyShow all
The caption and fill-ramp builders shared by the one-row progress meters, GaugeElement and ProgressBarElement.
The caption and fill-ramp builders shared by the one-row progress meters, GaugeElement and ProgressBarElement.
A view reaches for whichever meter fits and gets the same vocabulary either way: the same caption trio and the same two ramps, so the two are captioned and colored identically whichever one a view reaches for. They were once the same five method bodies written out on both elements — a pair that had already drifted in its wording and would have drifted in its behavior next.
The Self type is F-bounded so every builder answers the element's own type and a mixed chain — progressBar(0.5).bare.preset(...) — keeps the element-specific builders reachable after a shared one. An implementer supplies three hooks: the caption and ramp it currently carries, and a rebuild with both replaced.
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Known subtypes
-
class GaugeElementclass ProgressBarElement
One-shot questions for a command-line program that is not a full-screen app: ask, get a value back, leave one line behind.
One-shot questions for a command-line program that is not a full-screen app: ask, get a value back, leave one line behind.
val name: Option[String] = Prompt.text("Project name", validate = Prompt.required)
val tier: Option[Tier] = Prompt.select("Tier", Tier.values.toSeq)
val ok: Option[Boolean] = Prompt.confirm("Deploy?")
val cfg: Option[Config] = Prompt.form[Config]
Each call blocks the calling thread until the question is answered and returns Some(answer), or None when the user cancels — Ctrl-C in the terminal, the end of input when answering over a pipe. In a terminal the prompt is drawn in a Viewport.Inline strip at the bottom of the screen, never the alternate screen, and when it is answered the strip collapses to its summary line, ? Project name glyphora, which stays in the scrollback like any other command output.
Where the answers come from is the PromptSession in scope. With none named, prompts use the controlling terminal and fall back to plain line-based questions over standard input and output when there is no terminal to draw on (no TTY, TERM=dumb, CI set — see PromptSession.terminal's fallbackWhen). A test or an unattended run brings its own: given PromptSession = Prompt.answers(Seq("glyphora", "Pro", "y")).
Threads: call from a plain thread — main, a test — never from a render thread. A terminal prompt starts a runner of its own for the duration of the question.
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
Prompt.type
The LLM-CLI prompt: a multi-line editor with history, reverse search, ghost suggestions, trigger completion and paste compaction. Enter submits (onSubmit gets the expanded text), Shift+Enter or Alt+Enter inserts a newline; Up/Down on the first/last visual row walk the history; Ctrl+R searches it; a dim suggestion from history is accepted with Tab or Right; / and @ open the completion popup (Up/Down, Enter/Tab, Esc). Every editingChords chord works too.
The LLM-CLI prompt: a multi-line editor with history, reverse search, ghost suggestions, trigger completion and paste compaction. Enter submits (onSubmit gets the expanded text), Shift+Enter or Alt+Enter inserts a newline; Up/Down on the first/last visual row walk the history; Ctrl+R searches it; a dim suggestion from history is accepted with Tab or Right; / and @ open the completion popup (Up/Down, Enter/Tab, Esc). Every editingChords chord works too.
The composer is as tall as its draft once soft-wrapped at the width it is given, up to the state's maxRows, after which it scrolls inside them. prompt puts a glyph ("❯ ") before the first row; wrapped and further rows hang under the text rather than under the glyph.
Attributes
Attributes
- Companion
- class
- Supertypes
-
trait Producttrait Mirrorclass Objecttrait Matchableclass Any
- Self type
Where the Prompt calls made under it read their answers from and leave their summaries.
Where the Prompt calls made under it read their answers from and leave their summaries.
Three shapes, picked by the factory that built it:
- PromptSession.terminal (the
givenevery prompt finds when the caller names none): each prompt is a one-shot app in aViewport.Inlinestrip at the bottom of the terminal, which it collapses to its one-line summary when it is answered. When the process has no terminal to be interactive on —fallbackWhensays so, or the backend cannot be opened (TERM=dumb, no TTY), or the backend fails while the prompt runs — it degrades to the plain shape over standard input and output instead of failing. - PromptSession.plain: line-based question and answer over a reader and a writer, with no cursor movement and no escape sequences. What a pipe, a CI log or a screen reader wants.
- PromptSession.scripted (also spelled Prompt.answers): every answer is pre-supplied, in order, and parsed exactly as a typed one would be. What a test and an unattended CI run want. An answer the prompt rejects, or a prompt left without an answer, throws
IllegalArgumentException— a script that no longer matches its program is a bug to surface, not a question to hang on.
Every session keeps the summary line of each prompt answered under it in transcript, in order — "? Name alpha" — which is how a test asserts on what the user would have seen left in their scrollback.
Threads: a session is used by one prompt at a time, from the thread that calls the prompt (never a render thread: a terminal prompt starts a runner of its own and blocks until it is answered). The transcript is synchronized, so it can be read from anywhere.
Attributes
- Companion
- object
- Supertypes
-
class Objecttrait Matchableclass Any
Attributes
- Companion
- class
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
PromptSession.type
A scannable QR code for text — see w.QrCode. Claims exactly the box the symbol and its quiet zone measure, so it sits beside text in a row without being stretched; the code is only readable whole, so give it that room.
A scannable QR code for text — see w.QrCode. Claims exactly the box the symbol and its quiet zone measure, so it sits beside text in a row without being stretched; the code is only readable whole, so give it that room.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait Elementclass Objecttrait Matchableclass AnyShow all
Mutually exclusive options: Up/Down move the selection while focused.
Mutually exclusive options: Up/Down move the selection while focused.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait Elementclass Objecttrait Matchableclass AnyShow all
A two-thumb range slider over a caller-owned w.RangeSliderState. While focused, Left/Right move the thumb that has the keyboard by state.range.step and Home/End send it to its limit; a thumb stops at the other one (and at the state's minimum gap), so the two never cross. Tab hands the keyboard from the lower thumb to the upper one and Shift+Tab back; from the upper thumb Tab is left unconsumed, so focus moves on to the next control as usual and a user is never trapped inside the slider. A press or drag on the track moves whichever thumb is nearer. onChange hears the pair after every move.
A two-thumb range slider over a caller-owned w.RangeSliderState. While focused, Left/Right move the thumb that has the keyboard by state.range.step and Home/End send it to its limit; a thumb stops at the other one (and at the state's minimum gap), so the two never cross. Tab hands the keyboard from the lower thumb to the upper one and Shift+Tab back; from the upper thumb Tab is left unconsumed, so focus moves on to the next control as usual and a user is never trapped inside the slider. A press or drag on the track moves whichever thumb is nearer. onChange hears the pair after every move.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait Elementclass Objecttrait Matchableclass AnyShow all
A recoverable keymap collision or unsupported framework sequence, naming the affected binding ids.
A recoverable keymap collision or unsupported framework sequence, naming the affected binding ids.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
A subtree chosen by the terminal's size — a media query — or, built by responsive.local, by its own area.
A subtree chosen by the terminal's size — a media query — or, built by responsive.local, by its own area.
build is handed the size of the whole terminal, not this node's allotted area, and runs during ResponsivePass before the focus pass, so whatever it returns is an ordinary part of the tree: its focusables take Tab stops, its handlers receive keys, and clicks hit-test into it — unless the node sits on a layer a modal covers, in which case ResponsivePass suppresses the branch along with the rest of that layer. That is what makes swapping components work and not just constraints — a row of three panes at 120 columns can become a tabbedContent at 60.
The node is otherwise transparent: it holds the built branch as its single child, so a constraint, a style, or an onKeyEvent set on it applies exactly as it would on a column wrapping the same content, and the branch's own layout claim becomes the node's when none is set explicitly.
resolved is filled in by ResponsivePass on every render, never by user code — the same contract FocusState has. While it is empty the node still renders: it falls back to building against its own area, so a construction test that draws element.widget straight into a buffer without a TuiApp behind it shows content rather than blank space. That fallback has no focus pass behind it, so focusables inside it are inert — which is why the pass exists rather than doing this at render time.
'''Container queries.''' With local set — responsive.local — build is handed this node's own area instead, found by the layout pre-pass in ResponsivePass.resolveFrame: the tree is painted once into a scratch buffer with this node unresolved, the node records the area it was handed, and the pass builds the branch for that size — still before the focus pass, so the branch is as much a part of the tree as a media query's. Because the area has to be known before the branch exists, a local node's size never depends on its branch: it claims what its own constraint says, or a fill, and measures as unmeasurable unless given a .length(n) — the size containment a CSS container query asks for too. probe is the pre-pass's handle on an unresolved local node; like resolved, only the pass writes it.
Attributes
Attributes
- Companion
- class
- Supertypes
-
trait Producttrait Mirrorclass Objecttrait Matchableclass Any
- Self type
-
ResponsiveElement.type
A block of text that already carries its own styles, laid out the way TextElement lays out a plain string.
A block of text that already carries its own styles, laid out the way TextElement lays out a plain string.
TextElement holds a String and paints the whole block in the element's one style, which is the right shape for a caption but cannot show a markup"…" literal or the coloured output Text.fromAnsi reads back from a subprocess: both arrive as a io.worxbend.tui.core.Text whose spans have already chosen their colours. Before this node the only way to show one was widget(Paragraph(text)), which needs a second import and claims every row the container has left, so a styled message under a plain one pushed the plain one off the screen.
The overflow and alignment knobs are the same two TextElement offers and mean the same thing. The element's own style is laid underneath the text's own base style, so a span that set a colour keeps it and .dim on the element dims only what the spans left unset — the direction a theme colour travels, as Span.under documents.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait Elementclass Objecttrait Matchableclass AnyShow all
Children laid out side by side, left to right.
Children laid out side by side, left to right.
A child marked .auto is exactly as wide as it measures (Element.intrinsicWidth); .alignItems(...) places the children vertically inside the row and a child's own .alignSelf(...) overrides that — see io.worxbend.tui.core.CrossAlign.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait FlexContainertrait Elementclass Objecttrait Matchableclass AnyShow all
One entry of the app's screen stack. See Presentation for how it sits over the view beneath; push and pop via TuiApp.pushScreen/popScreen.
One entry of the app's screen stack. See Presentation for how it sits over the view beneath; push and pop via TuiApp.pushScreen/popScreen.
Attributes
- Companion
- object
- Supertypes
-
class Objecttrait Matchableclass Any
A scrollable viewport over taller-than-the-screen content. Up/Down/PageUp/PageDown scroll while focused.
A scrollable viewport over taller-than-the-screen content. Up/Down/PageUp/PageDown scroll while focused.
contentHeight is the caller's own measurement; None means "measure the content each frame", which is what the two-argument scrollView(content, state) factory asks for.
A searched view (.searchable(state)) finds its matches by painting the whole content once per query and content, then reuses them: a frame that only scrolls, steps or redraws paints just the window.
The view keeps what matters on screen by itself. When focus moves onto a child outside the window, or a child marked .ensureVisible appears, the view scrolls just far enough to show it, and records the request in state, so a child that stays focused or marked does not drag the view back after the reader scrolls away. A mark wins over focus; .followFocus(false) turns focus-following off. Every scroll view around the child scrolls its part of the way, nested ones included. The offset is resolved before the content paints, from where the last frame painted the target, so the content is painted once and every recorded rect is the one on screen; a target that was not on the last frame (it just appeared) is revealed on the frame after it first paints.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait Elementclass Objecttrait Matchableclass AnyShow all
A scrollbar strip on its own, for content this package does not scroll for you.
A scrollbar strip on its own, for content this package does not scroll for you.
ScrollViewElement draws its own scrollbar, so the common case needs nothing here. This node is for the case where the thing being scrolled is not a scrollView — a list whose offset the application keeps, a log tailing in a pane, a table with more rows than fit — and the view wants to show how far through it the reader is. Before it, the only way to put a scrollbar on such a pane from the DSL was widget(Scrollbar(...)), which meant importing io.worxbend.tui.widgets into a view for one type.
The widget underneath is stateless: where the thumb sits is a pure function of contentLength, position and the area, so this node holds two plain numbers plus the io.worxbend.tui.widgets.ScrollbarOptions describing how the bar looks, and nothing that has to be kept in step with anything. An out-of-range position pins the thumb to an end rather than drawing it off the track, and when the content already fits the area only the track is drawn.
A vertical scrollbar paints on the right edge of the area it is given and a horizontal one on the bottom edge, which is why it is usually given a one-column or one-row slice next to the content rather than laid over it.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait Elementclass Objecttrait Matchableclass AnyShow all
The query input of a search: a one-row text field over the caller-owned w.SearchState's own w.SearchState.input, so every keystroke changes the query the searched view (log(…).searchable(state), scrollView(…).searchable(state), markdown(…).searchable(state)) finds on its next frame — the search is live.
The query input of a search: a one-row text field over the caller-owned w.SearchState's own w.SearchState.input, so every keystroke changes the query the searched view (log(…).searchable(state), scrollView(…).searchable(state), markdown(…).searchable(state)) finds on its next frame — the search is live.
While focused: typing and the shared editing chords edit the query; Enter (or Down) steps to the next match and Shift+Enter (or Up) to the previous one; Esc clears the query and the highlight. With nothing to clear, Esc is left to bubble.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait Elementclass Objecttrait Matchableclass AnyShow all
The search highlights of a searchable log, scrollView or markdown under "search": SearchRole.Match for every match, SearchRole.Current for the one n/N is on. A theme that leaves them silent highlights in its own warning colour (a match) and error colour, bold (the current one), so search follows Theme.Light and every preset without a line of configuration.
The search highlights of a searchable log, scrollView or markdown under "search": SearchRole.Match for every match, SearchRole.Current for the one n/N is on. A theme that leaves them silent highlights in its own warning colour (a match) and error colour, bold (the current one), so search follows Theme.Light and every preset without a line of configuration.
Attributes
- Supertypes
-
trait Singletontrait Producttrait Mirrortrait Serializabletrait Producttrait Equalstrait ComponentRoleclass Objecttrait Matchableclass AnyShow all
- Self type
-
SearchRole.type
A one-row option cycler. Left/Right step through options while focused (wrapping at both ends) and a click advances one; the selection is an index into options, so it survives nothing but a stable option list.
A one-row option cycler. Left/Right step through options while focused (wrapping at both ends) and a click advances one; the selection is an index into options, so it survives nothing but a stable option list.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait Elementclass Objecttrait Matchableclass AnyShow all
A multi-select list: Up/Down move the cursor, Space toggles membership of the cursor row; the wheel moves the cursor on hover, as it does over a list.
A multi-select list: Up/Down move the cursor, Space toggles membership of the cursor row; the wheel moves the cursor on hover, as it does over a list.
selected is the set the view read (tracked at construction, see CheckboxElement); onToggle is handed the row whose membership Space flipped.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait Elementclass Objecttrait Matchableclass AnyShow all
A skeleton placeholder, themed at construction.
A skeleton placeholder, themed at construction.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait Elementclass Objecttrait Matchableclass AnyShow all
A value slider: Left/Right adjust by range.step, Home/End jump to the bounds, while focused.
A value slider: Left/Right adjust by range.step, Home/End jump to the bounds, while focused.
The bounds and the step arrive together as a io.worxbend.tui.widgets.SliderRange. That is what keeps the key handler honest: it consumes Left/Right by construction, so a zero step would swallow both arrows and do nothing with them, and a negative one would reverse them.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait Elementclass Objecttrait Matchableclass AnyShow all
Composes one frame of a View into a Buffer, with no runner, no terminal and no event loop.
A live frame is composed by TuiApp, which needs a Runner and a Backend underneath it. That is the right shape for an application and the wrong shape for the two jobs this exists for: rendering a view to text from a plain unit test, and letting an application export what a view would look like at a given size — a screen dump for a bug report, a rendered README, a golden-frame fixture.
It runs the same two passes a live frame does, in the same order — the responsive resolve, which lets a responsive node pick its branch for the size, then the focus decoration — so an exported screen matches what an app would paint at that size rather than approximating it. SnapshotSpec asserts that against a live Pilot run, which is what keeps the two from drifting.
What it deliberately is not: interactive or animated. There is no clock, so an animated element renders at whatever position it computes for the elapsed time it is handed; reactive reads subscribe nothing, so nothing here will ever ask for a redraw; and there is no focus tracking, only the one element named by focusedKey drawn as focused.
Callable from any thread: it registers no render loop and writes no signal.
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
Snapshot.type
Blank space: flexible by default, fixed once .length(n) sets a constraint.
Blank space: flexible by default, fixed once .length(n) sets a constraint.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait Elementclass Objecttrait Matchableclass AnyShow all
A one-row dense line chart of recent values.
A one-row dense line chart of recent values.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait Elementclass Objecttrait Matchableclass AnyShow all
Attributes
- Companion
- enum
- Supertypes
-
trait Sumtrait Mirrorclass Objecttrait Matchableclass Any
- Self type
-
SpatialDirection.type
A direction for spatial focus movement — see ElementHost.focusInDirection and TuiApp.spatialNavigation.
A direction for spatial focus movement — see ElementHost.focusInDirection and TuiApp.spatialNavigation.
Attributes
- Companion
- object
- Supertypes
-
trait Enumtrait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
A spinner whose colors were resolved from the ambient Theme at construction.
A spinner whose colors were resolved from the ambient Theme at construction.
The theme supplies the glyph and label styles; anything the call site sets with .fg/.bold/.styled layers on top of the glyph style, so spinner(tick).fg(Color.Red) recolors the moving part and leaves the label alone.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait Elementclass Objecttrait Matchableclass AnyShow all
A themed block of phase-offset spinners.
A themed block of phase-offset spinners.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait Elementclass Objecttrait Matchableclass AnyShow all
An intro shown before the first view render: content (typically a bigText logo composition) plays effect and holds for at least minimumDuration; any key skips it. Wire via TuiApp.splash.
An intro shown before the first view render: content (typically a bigText logo composition) plays effect and holds for at least minimumDuration; any key skips it. Wire via TuiApp.splash.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
Two panes split by an adjustable divider: [/] shift the split while the pane itself is focused.
Two panes split by an adjustable divider: [/] shift the split while the pane itself is focused.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait Elementclass Objecttrait Matchableclass AnyShow all
The styles one component draws in, per interaction state.
The styles one component draws in, per interaction state.
base is the resting style, layered under whatever the element itself sets (an explicit .fg(...) still wins). The other four are layered over it while their state holds — focused while the element has the keyboard, hovered while the pointer rests on it, pressed from a button going down on it to the release, disabled while it or an ancestor is .disabled. A state left at io.worxbend.tui.core.Style.Default says nothing, and the element falls back to what it drew before component styles existed: the theme's focus cue, the element's own .hoverStyle/.pressedStyle, the theme's disabled style.
The precedence when several states hold is the one the focus pass has always used: disabled replaces everything, and otherwise focused, then hovered, then pressed are layered in that order.
A plain value, read on the render thread by the DSL host; the widgets never see it — they get the resolved Style.
Attributes
- Companion
- object
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
Attributes
- Companion
- class
- Supertypes
-
trait Producttrait Mirrorclass Objecttrait Matchableclass Any
- Self type
-
StateStyles.type
A dotted, hierarchical style name — "button", "button.primary", "list.selected" — that a Theme looks its StateStyles up by.
A dotted, hierarchical style name — "button", "button.primary", "list.selected" — that a Theme looks its StateStyles up by.
The hierarchy is Brick's attribute-map idea, kept typed and without selectors: "list.selected" falls back to "list", and every field the child leaves unset is taken from the parent through io.worxbend.tui.core.Style.patch. So a theme can say "every list is on a grey surface" once, at list, and the selected row adds only what makes it selected. There is no matching against the element tree and no per-frame cost beyond one map lookup per segment.
A name is a value and needs no validation beyond "not blank": an empty segment ("a..b") is dropped, so a name always has at least one segment and its parent chain always ends.
Attributes
- Companion
- object
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
Attributes
- Companion
- class
- Supertypes
-
trait Producttrait Mirrorclass Objecttrait Matchableclass Any
- Self type
-
StyleScopeElement.type
The node withStyle builds: inner, with base cascading onto every node beneath it when painted.
The node withStyle builds: inner, with base cascading onto every node beneath it when painted.
The focus pass layers the cascade in and marks the scope applied; a scope painted without one — a widget-level test calling .widget directly — applies it itself, eagerly, on that paint. Its own props start from the wrapped node's layout claims and are otherwise its own, so it is never a second focus target for the node it wraps; .fg(...) and the other styling builders on the scope add to base.
Attributes
A static table whose cells carry their own styles, and whose rows can be taller than one line.
A static table whose cells carry their own styles, and whose rows can be taller than one line.
The same widget as TableElement draws both; the difference is what a cell is made of. Here a cell is a io.worxbend.tui.core.Line — or a io.worxbend.tui.widgets.TableCell when it has to span several columns — so one figure in a row can be red while the rest of the row stays plain. A row is either a bare sequence of those cells, one line tall, or a io.worxbend.tui.widgets.TableRow, which adds a height, top and bottom margins and a style of its own. Both shapes may appear in the same table.
Before this node the DSL could express none of that: table(...) takes Strings, so a caller wanting a single green cell had to drop out of the element tree into widget(w.Table(...)) and give up every fluent builder on the way. The two nodes stay separate rather than becoming one node over a union type, because a union two collections deep is unpleasant to read and to infer — the same reasoning that gives the widget its Table.ofStrings.
A FlexContainer, exactly like TableElement: .center / .flexEnd place the block of columns when fixed-width columns leave room over, and .gap(n) sets the blank cells between neighbouring columns.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait FlexContainertrait Elementclass Objecttrait Matchableclass AnyShow all
A tab row plus the selected page (Textual's TabbedContent): Left/Right switch pages while focused. Only the active page's focusables participate in the tab order.
A tab row plus the selected page (Textual's TabbedContent): Left/Right switch pages while focused. Only the active page's focusables participate in the tab order.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait Elementclass Objecttrait Matchableclass AnyShow all
A static table of rows under fixed column widths.
A static table of rows under fixed column widths.
A FlexContainer, so the alignment builders every row and column has work here too — .center and .flexEnd place the block of columns inside the area when fixed-width columns leave space over, and .gap(n) sets the blank cells between neighbouring columns. Its "children" are its columns rather than nested elements, which is why it carries the trait without carrying a children list.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait FlexContainertrait Elementclass Objecttrait Matchableclass AnyShow all
The header row of a table, "table.header"; its base replaces the widget's own bold default when it says something.
The header row of a table, "table.header"; its base replaces the widget's own bold default when it says something.
Attributes
- Supertypes
-
trait Singletontrait Producttrait Mirrortrait Serializabletrait Producttrait Equalstrait ComponentRoleclass Objecttrait Matchableclass AnyShow all
- Self type
-
TableHeaderRole.type
A one-row tab strip. Purely presentational — see TabbedContentElement for the interactive version.
A one-row tab strip. Purely presentational — see TabbedContentElement for the interactive version.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait Elementclass Objecttrait Matchableclass AnyShow all
A tag (chip) field over a caller-owned w.TagInputState: committed tags draw as chips that wrap onto further rows through w.Flow, followed by the text being typed. While focused, typing edits the text with every key a text field knows; Enter or a comma commits it as a tag, Backspace on an empty field removes the last tag, and Tab (or Right at the end of the text) accepts the dim suggestion when there is one. onChange hears the tags after every commit or removal. An Enter on a blank field, and a Tab with nothing to accept, keep bubbling.
A tag (chip) field over a caller-owned w.TagInputState: committed tags draw as chips that wrap onto further rows through w.Flow, followed by the text being typed. While focused, typing edits the text with every key a text field knows; Enter or a comma commits it as a tag, Backspace on an empty field removes the last tag, and Tab (or Right at the end of the text) accepts the dim suggestion when there is one. onChange hears the tags after every commit or removal. An Enter on a blank field, and a Tab with nothing to accept, keep bubbling.
Measures as many rows as its chips wrap onto at the width it is given, and reports its caret like every text node.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait Elementclass Objecttrait Matchableclass AnyShow all
Where the work under Prompt.task reports what it is doing: one call, one line in the scrolling log under the spinner. Safe to call from any thread — the work runs on a thread of its own, and so may anything it starts.
Where the work under Prompt.task reports what it is doing: one call, one line in the scrolling log under the spinner. Safe to call from any thread — the work runs on a thread of its own, and so may anything it starts.
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
A template-driven input (##/##/####): # accepts a digit, A a letter, literals insert themselves.
A template-driven input (##/##/####): # accepts a digit, A a letter, literals insert themselves.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait Elementclass Objecttrait Matchableclass AnyShow all
Multi-line editor element. While focused it consumes printable characters, Enter (newline), Backspace, Delete, arrows, Home/End and the shared editing chords (editingChords: selection, word motion, clipboard, kill ring, Ctrl+Z undo, Ctrl+Shift+Z redo) — Tab stays free for focus traversal. A bracketed paste lands as one edit, with CRLF and bare CR normalized to logical line breaks. Paste in the open search edits its first query line instead.
Multi-line editor element. While focused it consumes printable characters, Enter (newline), Backspace, Delete, arrows, Home/End and the shared editing chords (editingChords: selection, word motion, clipboard, kill ring, Ctrl+Z undo, Ctrl+Shift+Z redo) — Tab stays free for focus traversal. A bracketed paste lands as one edit, with CRLF and bare CR normalized to logical line breaks. Paste in the open search edits its first query line instead.
Search: Ctrl+F opens the /query prompt (so does / in a readOnly area); typing searches incrementally, Enter keeps the match and closes the prompt, Esc cancels back to where the search started. Afterwards F3 / Shift+F3 (and n / N when read-only) step to the next and previous match.
searchable hands the search to a caller-owned w.SearchState instead, the path log, scrollView and markdown take: a searchBar over the same state types the query, the matches are highlighted in the theme's search styles, and every move of the search puts the caret on the current match. F3 / Shift+F3 (and n / N when read-only) then step that shared search, and Ctrl+F / / are left to bubble to the app, which owns the bar.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait Elementclass Objecttrait Matchableclass AnyShow all
A block of plain text; one row per newline-separated line.
A block of plain text; one row per newline-separated line.
Two things about how the text meets the edges of its area can be asked for here. Overflow decides what happens to a line longer than the area is wide: io.worxbend.tui.widgets.Overflow.Clip, the default, cuts it off at the right edge, while .wrapped breaks it onto as many rows as it needs. Alignment decides where a line shorter than the area sits: at the left edge by default, or in the middle with .centered, or against the right edge with .rightAligned.
Both were already parameters of the widgets.Paragraph this node renders through, but the node built that paragraph with the defaults and offered no way to say otherwise, so a paragraph of prose in the DSL was clipped at the first screen column it ran past and every heading had to be centred by hand with padding.
Wrapping also changes what the node claims from its container, and it has to: a wrapping paragraph does not want a column per character of its longest line — it wants whatever width it is given and however many rows that width makes it into. A clipping paragraph still claims its exact unwrapped box, which is what makes row(text("ab"), text("cd")) put the two next to each other rather than letting the first eat the row.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait Elementclass Objecttrait Matchableclass AnyShow all
Semantic styles the chrome presets, the themed element factories, and applications draw from.
Semantic styles the chrome presets, the themed element factories, and applications draw from.
A TuiApp hands its own TuiApp.theme to view as a using parameter, so everything a view calls sees it without any given ceremony. Outside a view — a widget-level test, an element built in a helper object — the ambient Theme.default applies at construction, and an element built against it is re-resolved against the app's own theme when it is painted (see LateBinding), so a helper's panel follows Theme.Light like the rest.
The three sub-palettes are grouped rather than flattened because they retheme as units: loading for the spinner and progress family, markdown for a rendered document, and markdown.syntax (mirrored as syntax for the standalone highlighter) for code.
A final class with a private constructor rather than a case class, as Style, Layout and RunnerConfig are, because this is the type a new semantic role lands in. A case class rewrites apply, copy and unapply on every new field, and a consumer compiled against the old shape fails with NoSuchMethodError; here the compatibility surface is the three presets plus the with* builders — Theme.Dark.withBorder(...) where the docs used to say Theme.Dark.copy(border = ...) — all of which a new field leaves untouched. There is no copy and no pattern extractor; equality and hashCode are structural over every field, and toString is Theme(), which is what a theme switcher and a failed assertion both want to see.
Value parameters
- border
-
the frame style
panelandruledraw with when the caller sets no style of their own. - focus
-
the cue the focus pass paints on the focused element, and the selection highlight of the scrollable widgets.
- glyphs
-
the ceiling every themed factory keeps its glyphs under. The three built-in themes stay at io.worxbend.tui.core.GlyphSupport.Full, which is what a modern terminal emulator can draw. An application that has to run somewhere less certain writes
theme = Theme.detected()and every panel border, spinner and progress bar in the tree follows, with no other call site changing.
Attributes
- Companion
- object
- Supertypes
-
class Objecttrait Matchableclass Any
A one-row hh:mm:ss field over a caller-owned w.TimePickerState. While focused, Left/Right move between the hour, minute and second fields and Up/Down step the time by the focused field's unit, wrapping past midnight — one minute up from 23:59 is 00:00. Digits type into the focused field: two make its value (clamped to the field's maximum) and move focus on, so 0930 sets 09:30. The focused field wears the focus style.
A one-row hh:mm:ss field over a caller-owned w.TimePickerState. While focused, Left/Right move between the hour, minute and second fields and Up/Down step the time by the focused field's unit, wrapping past midnight — one minute up from 23:59 is 00:00. Digits type into the focused field: two make its value (clamped to the field's maximum) and move focus on, so 0930 sets 09:30. The focused field wears the focus style.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait Elementclass Objecttrait Matchableclass AnyShow all
A labelled on/off switch — a CheckboxElement in switch clothing, with the same Space/Enter/click activation.
A labelled on/off switch — a CheckboxElement in switch clothing, with the same Space/Enter/click activation.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait Elementclass Objecttrait Matchableclass AnyShow all
The strip inside a Element.toolbar or Element.buttonGroup: its controls left to right at their natural widths over w.Toolbar, gap columns apart with an optional divider. When they do not all fit, the strip shows the window that does, marked « / », and slides it so the focused control is always on screen — the controls themselves stay in the enclosing focus group, so the arrows still reach every one of them.
The strip inside a Element.toolbar or Element.buttonGroup: its controls left to right at their natural widths over w.Toolbar, gap columns apart with an optional divider. When they do not all fit, the strip shows the window that does, marked « / », and slides it so the focused control is always on screen — the controls themselves stay in the enclosing focus group, so the arrows still reach every one of them.
With an overflow state the » is also a button: a click on it opens a popup, floated through the frame root under the marker, holding the controls the strip left out — the very same elements, so a click on one presses it and closes the popup. A press outside the popup, Esc from the focused control, or another click on » closes it. While it is open the hidden controls are children of the popup rather than of the strip, so they keep their place in the focus group but come after the visible ones in it.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait Elementclass Objecttrait Matchableclass AnyShow all
A collapsible tree over an in-memory node list. Up/Down move the selection through the visible rows and Enter expands or collapses the selected branch (a no-op on a leaf), all while focused; the wheel moves the selection on hover, as it does over a list.
A collapsible tree over an in-memory node list. Up/Down move the selection through the visible rows and Enter expands or collapses the selected branch (a no-op on a leaf), all while focused; the wheel moves the selection on hover, as it does over a list.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait Elementclass Objecttrait Matchableclass AnyShow all
A tree with columns over a caller-owned w.TreeState. While focused, Up/Down move the selection through the visible rows, Enter toggles the selected branch, Right expands it and Left collapses it; the wheel moves the selection on hover. The selected row wears the focus style across every column.
A tree with columns over a caller-owned w.TreeState. While focused, Up/Down move the selection through the visible rows, Enter toggles the selected branch, Right expands it and Left collapses it; the wheel moves the selection on hover. The selected row wears the focus style across every column.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait Elementclass Objecttrait Matchableclass AnyShow all
The application entry point for the declarative DSL.
The application entry point for the declarative DSL.
view is re-evaluated under a tracking ReactiveScope: any Signal read during the last evaluation schedules a redraw when it changes — state lives in signals, not in an explicitly threaded State value.
Focus and events: focusable elements form a tab order in depth-first view order; Tab / Shift+Tab cycle focus and a mouse press focuses the innermost focusable under the pointer; focusTo and clearFocus move it from code. Key events start at the focused element and bubble to its ancestors (true consumes), then the top screen's Screen.bindings merged over the app's bindings run — see activeBindings; an unconsumed Ctrl+P opens the command palette (when bindings exist) and Ctrl+C quits.
App services: pushScreen/popScreen/replaceScreen/resetScreens for modal or full-screen navigation (layers below a modal leave the tab order), with currentScreen/screenDepth as reactive reads of where navigation stands, notify for timed toasts, openPalette for the fuzzy command palette over the declared bindings. Call quit from any handler to exit cleanly.
Lifecycle: onStart runs on the render thread before the first frame — start pollers and timers there — and onStop runs on every exit path, which is where they are cancelled. A screen has the same pair of its own, Screen.onEnter/Screen.onLeave, for work that belongs to a subtree rather than to the whole app. Between the two, requestRedraw schedules a frame for state the reactive layer cannot see, such as a plain field of the app's own filled in by a background result (widget states are versioned and watched, and need no such call).
Running it: the trait supplies main, so object MyApp extends TuiApp is already a runnable program. Reach for run directly only when the app is started from code that owns the process (an existing main, a launcher), and for runWith when a test drives it over a HeadlessBackend.
Attributes
- Companion
- object
- Supertypes
-
class Objecttrait Matchableclass Any
Companion of every TuiApp: holds the accessibility audit pilot.a11yReport(app) finds for any app type, because a type's implicit scope includes the companions of its base traits.
Vertical placement of a block inside the area it is drawn in — the down-the-screen counterpart of Alignment.
Vertical placement of a block inside the area it is drawn in — the down-the-screen counterpart of Alignment.
Attributes
- Supertypes
-
trait Enumtrait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
State that belongs to a place in the view tree rather than to the application object.
State that belongs to a place in the view tree rather than to the application object.
Why this exists. Everything reactive in glyphora is either a Signal the app declares as one of its own fields or a caller-owned widget state (ListState, TextInputState). Both have to be declared next to the app and threaded by hand into the factory call that uses them, which means a reusable piece of view — a collapsible section, a counter, a search box — cannot own anything privately. Its caller has to declare the state and pass it in, and a caller that builds five of them has to declare five.
useSignal and useState remove that. They hand back a value that is created the first frame the call is reached and then given back, the same instance, on every later frame that reaches it again — so the state belongs to the call site rather than to whoever wrote the app.
The identity of a call site is the chain of enclosing keyed scopes plus the position of the call within its scope. That is what makes the one rule worth memorising: a view must reach the same hook calls in the same order every frame. A hook behind an if that flips changes the positions of everything after it, and the state shifts between call sites. Building elements in a loop needs an identity per iteration, keyed by the item's own identity (its id, not its index), so that adding or removing an item does not renumber its neighbours: each provides it together with the focus key, and keyed is the same scope on its own for a loop each does not fit. Declaring a responsive builder reserves one position; its delayed hooks run in a child scope captured at that declaration. Reusing the same responsive value in multiple places gives each occurrence its own positional child scope.
Lifetime: a slot is created on the first frame that reaches it and dropped at the end of the first frame that does not. Hiding a subtree and showing it again therefore starts it fresh, which is the behaviour a collapsed panel wants; state that must outlive its own disappearance belongs in a Signal field on the app. Full-screen navigation retains ordinary eager state in covered entries without evaluating their builders; resources and discarded responsive slots are still swept. Uncovering restarts the resources with the retained ordinary state.
Lifetime hooks. A slot whose value is a ViewState.HookResource — the cells behind useEffect and useTask — is disposed when it is swept, when the host is reset, and when the run ends, which is what cancels an effect or a task the moment its node stops being drawn. Effects start after the frame that reached them has been painted: the host calls afterPaint once the paint is published, and that is also when useArea cells compare what they answered with where their node actually landed.
Ownership and threads: one store belongs to one ElementHost mount (one TuiApp run) and is touched only while that run's render thread is evaluating or painting the view. Nothing here is synchronised, and nothing needs to be.
Attributes
- Companion
- object
- Supertypes
-
class Objecttrait Matchableclass Any
Escape hatch: any core Widget as a leaf element.
Escape hatch: any core Widget as a leaf element.
The element style — .fg, .bg, .style(...), a withStyle cascade — is painted under the widget: once the widget has drawn, every cell of the area takes the style's fields the cell left unset, so the widget's own colours win and the cells it never touched take the background. An unstyled leaf draws exactly what the widget draws.
Width-dependent content — wrapped markdown, a paragraph, an image — reports its own height to the measurement pass by implementing io.worxbend.tui.core.Measured on the widget; this node needs no measurement wiring of its own.
That measurement is not a layout claim, though: the two passes ask different questions and only the measurement pass (scroll views, auto-sized containers) consults Measured. By default a wrapped widget takes every cell its siblings left over, because a bare Widget has no axis-independent size to derive one from — heightAt needs a width the layout solver has not decided yet, so guessing would mis-size wrapped prose rather than fix anything.
rows is how the call site says otherwise: Some(n) means "exactly n rows tall, and whatever width the container has", which is the shape every fixed-height widget actually wants. Use it rather than .length(n) — that extension sets one constraint that the container applies along whichever axis it runs, so a .length(1) widget is one row tall in a column and one column wide in a row.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait Elementclass Objecttrait Matchableclass AnyShow all
A movable, resizable floating window over a caller-owned w.WindowState, drawn by w.Window: a frame with the title on top and a ◢ grip in the bottom-right corner, its content inside. Place windows in a WindowStackElement (windowStack), which draws them at their state's rectangles in stacking order.
A movable, resizable floating window over a caller-owned w.WindowState, drawn by w.Window: a frame with the title on top and a ◢ grip in the bottom-right corner, its content inside. Place windows in a WindowStackElement (windowStack), which draws them at their state's rectangles in stacking order.
Pointer: a press anywhere on the window raises it above the others; a drag that starts on the title row moves it and one that starts on the grip resizes it — the press captures the pointer, so the drag keeps following once the pointer leaves the window. Keyboard, while focus is inside the window: the window-move framework key (Alt+M) enters a move mode and window-resize (Alt+R) a resize mode, in which the arrows move or resize the window one cell at a time and Enter or Esc leave; the mode shows in the title. A window whose content has nothing to focus is a tab stop itself, so it can always be arranged from the keyboard.
Styled like every container: frameStyle is the border and the caption (the theme's border from window, and bold while focus is inside), and the element's own style is the content style, layered under what the content draws.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait Elementclass Objecttrait Matchableclass AnyShow all
Floating windows over the area it is given — usually the overlay of a layers(base, windowStack(...)). Each WindowElement is drawn at its state's rectangle, nudged back inside the area when it has been dragged past an edge (the state records the actual painted rectangle), in stacking order: a larger z — the window raised last — draws on top and so takes the pointer where windows overlap. Other children draw across the whole area, beneath every window. Paints nothing of its own, so a press between the windows reaches whatever is underneath.
Floating windows over the area it is given — usually the overlay of a layers(base, windowStack(...)). Each WindowElement is drawn at its state's rectangle, nudged back inside the area when it has been dragged past an edge (the state records the actual painted rectangle), in stacking order: a larger z — the window raised last — draws on top and so takes the pointer where windows overlap. Other children draw across the whole area, beneath every window. Paints nothing of its own, so a press between the windows reaches whatever is underneath.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait Elementclass Objecttrait Matchableclass AnyShow all
An ordered multi-step flow over a caller-owned w.WizardState: the w.Wizard progress header, the refusal message of the last failed Next (in the theme's error style), the current step's content, and a Back / Next row — Next reads Finish on the last step and runs onFinish once that step validates. Back is disabled on the first step. The two buttons carry the focus keys wizard-back and wizard-next, so focus stays on Next while the user walks forward.
An ordered multi-step flow over a caller-owned w.WizardState: the w.Wizard progress header, the refusal message of the last failed Next (in the theme's error style), the current step's content, and a Back / Next row — Next reads Finish on the last step and runs onFinish once that step validates. Back is disabled on the first step. The two buttons carry the focus keys wizard-back and wizard-next, so focus stays on Next while the user walks forward.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait Elementclass Objecttrait Matchableclass AnyShow all
One screen of a Element.wizard: its title in the progress header, its content, and the check Next runs before leaving it — Some(message) refuses and shows the message, None lets the user on. The check runs on the render thread when Next is pressed, so it may peek the signals the step's controls write.
One screen of a Element.wizard: its title in the progress header, its content, and the check Next runs before leaving it — Some(message) refuses and shows the message, None lets the user on. The check runs on the render thread when Next is pressed, so it may peek the signals the step's controls write.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
Types
Which sides of a panel's frame are drawn — Borders.Top | Borders.Left, Borders.All, Borders.None.
Which sides of a panel's frame are drawn — Borders.Top | Borders.Left, Borders.All, Borders.None.
Named by PanelElement.borders(sides), so an application that wants a half-framed pane has to be able to write the value. It used to be reachable only through widgets.Block, which meant a second import for one bitset.
The third opaque type in the library, and written as a type alias plus a value alias rather than an export for the reason given on KeyModifiers: an exported opaque type loses its companion's extension methods, and without | the sides could not be combined at all.
Attributes
The modifier bitset carried by KeyEvent and MouseEvent.
The modifier bitset carried by KeyEvent and MouseEvent.
Written out as a type alias plus a value alias rather than added to the export above on purpose: an exported opaque type loses its companion's extension methods at the re-export site, so KeyModifiers.Ctrl | KeyModifiers.Shift would not compile for an application that only wrote import io.worxbend.tui.dsl.*. The explicit pair keeps |, hasAny, hasAll, names and show reachable.
Modifiers below is spelled the same way for the same reason. Plain classes and enums are unaffected, which is why everything else here is an export.
Attributes
The text-attribute bitset carried by Style — bold, dim, italic, underline, reverse, and the rest.
The text-attribute bitset carried by Style — bold, dim, italic, underline, reverse, and the rest.
Named by the exported API's own signatures (Style.modifiers returns one, Style.without(flags: Modifiers) takes one), so leaving it out would make those two members unusable from a dsl-only import. Written as a type alias plus a value alias, not an export, for the reason given on KeyModifiers: it is an opaque type, and an exported opaque type loses its companion's extension methods (|, hasAny, hasAll, names, show).
Borders below is the third opaque type in the library and is spelled the same way for the same reason.
Attributes
Caller-owned composer state; retained DSL spelling, implemented in the backend-independent widget tier.
Caller-owned composer state; retained DSL spelling, implemented in the backend-independent widget tier.
Attributes
The shape of an app's view (and any sub-view helper): a computation, run under a tracking ReactiveScope and the app's Theme, that produces the current Element tree. Reading a Signal inside it subscribes the next redraw. Mirrors terminus's type Program[A] = Terminal ?=> A — one named shape every view has.
The shape of an app's view (and any sub-view helper): a computation, run under a tracking ReactiveScope and the app's Theme, that produces the current Element tree. Reading a Signal inside it subscribes the next redraw. Mirrors terminus's type Program[A] = Terminal ?=> A — one named shape every view has.
The theme is part of the shape rather than something TuiApp installs around the call, because a given installed around the call is not in scope inside the body: an app that overrode theme and then wrote statusBar(bindings) in its own view used to silently resolve against Theme.Dark. Carrying it in the type means the compiler hands every themed helper the app's own theme, wherever the helper is written.
Attributes
Value members
Concrete methods
Declares one binding from a key spec string: "q", "ctrl+s", "shift+tab", "esc", "f2", "up", "+", or a sequence of them — "g g", "ctrl+k ctrl+s", " f" (see KeySequence.parse). A malformed spec is a programmer error and throws at construction (bindings are static app declarations).
Declares one binding from a key spec string: "q", "ctrl+s", "shift+tab", "esc", "f2", "up", "+", or a sequence of them — "g g", "ctrl+k ctrl+s", " f" (see KeySequence.parse). A malformed spec is a programmer error and throws at construction (bindings are static app declarations).
Each step's vocabulary is io.worxbend.tui.core.KeyEvent.parse's — the same one Pilot.press takes, so a test presses the string the app declared.
Attributes
content at a fixed size, centered both ways in whatever space is available.
content at a fixed size, centered both ways in whatever space is available.
Attributes
content laid over a backdrop that reports a mouse press no part of content took, so a dialog can be closed by clicking away from it.
content laid over a backdrop that reports a mouse press no part of content took, so a dialog can be closed by clicking away from it.
How it works, and what it therefore means. EventRouter resolves a press against the topmost sibling subtree that covers the pointer and never offers it to the ones underneath, and it only considers elements that recorded an area — that is, elements that are focusable or carry a mouse handler of their own. content is the later of the two layers here, so a press that lands on any of its controls is resolved there and the backdrop never hears about it. A press that lands where the dialog has no control resolves to nothing inside content and falls through to the backdrop, which is this node itself.
What the backdrop then does is decided by where the frame painted things. The host records the painted rect of every node (see NodeBounds), and a press that lands on a node of content that draws something — the dialog's border, its caption, a label inside it — is inside the dialog and is absorbed; a press that lands only on nodes that arrange space and draw nothing — the row, column and spacers that centered places the dialog with — is outside it and calls onOutsidePress. So "outside" means "outside the dialog's frame", which is what the user sees: the frame of the thing being used is part of the thing, and used to count as outside it because a border carries no control.
A dialog that wants to absorb presses on blank cells it owns but does not draw — a borderless column of labels, say — still says so at its root, exactly as before:
column(text("Really?"), button("OK")(ok())).onMouseEvent(_ => true)
Recording is switched on by this node's presence in the tree: a frame rendered before recording started (the first frame of a hand-layered overlay on a real terminal) falls back to treating every press that reaches the backdrop as outside, which is the old behaviour. TuiApp wires this for any modal Screen whose Dismissal includes a click outside and records from the frame that first shows it; call it directly only for a dialog an application layers itself.
Attributes
A centered help dialog listing every hinted binding — render it last (over the view) while visible.
A centered help dialog listing every hinted binding — render it last (over the view) while visible.
Attributes
Gives everything built inside body an identity of its own, so sibling instances of the same call site keep their own state.
Gives everything built inside body an identity of its own, so sibling instances of the same call site keep their own state.
Without it, three rows built by the same map all share one call site and therefore one set of slots. Key them by the item's own identity — never by its index, which renumbers the survivors when an item is removed and hands each of them their neighbour's state:
column(rows.map(row => keyed(row.id)(rowView(row)))*)
Keys have to be unique among siblings only, not across the whole view: a key is a step in a path, so the same key under two different parents is two different places.
Attributes
light on a light terminal, dark on a dark one — and on one that could not say, because dark is what every terminal was assumed to be before any of them could be asked.
light on a light terminal, dark on a dark one — and on one that could not say, because dark is what every terminal was assumed to be before any of them could be asked.
The scheme is read reactively through the app's AppServices.colorScheme, so a view that calls this recomputes when the terminal flips its theme under the app (mode 2031). Inside a TuiApp the services resolve on their own; a helper written elsewhere takes (using AppServices) as it would to raise a toast. Outside any run AppServices.NoOp reports Unknown, so the dark colour wins.
This picks a colour by the terminal's scheme, not by the app's theme: an app that pinned Theme.HighContrast still gets the colour that reads on the background the user actually has.
Attributes
The classic list-left, detail-right split.
The classic list-left, detail-right split.
Attributes
A Signal that survives a restart, with its file format derived from the value's type.
A Signal that survives a restart, with its file format derived from the value's type.
final case class Prefs(theme: String, sidebar: Boolean, recent: List[String])
private val prefs = persisted(configDir.resolve("prefs.txt"), Prefs("dark", sidebar = true, Nil))
This is Persisted.signal from tui-runtime with the two halves of the file format supplied by the Codec in scope — derived for any case class, enum or sealed hierarchy over the primitives, Option and the immutable collections, or hand-written next to the type through Codec.atom. It is the glue between a tui-macros typeclass and a tui-runtime value, which is why it lives here rather than in either of them.
The contract is Persisted.signal's: loaded synchronously when created (a missing or undecodable file yields initial), written back on an Async worker on every change, newest value wins, atomic replace. Create it as a field or in onStart, never per frame; the render-thread rules of Signal apply unchanged.
Attributes
Positions content (sized width x height) inside whatever area it is given, aligned horizontal x vertical (centered on both axes by default — the centered case). Pass backdrop to paint the surrounding whitespace with a style (Lip Gloss Place-style), e.g. a dimmed area behind a dialog.
Positions content (sized width x height) inside whatever area it is given, aligned horizontal x vertical (centered on both axes by default — the centered case). Pass backdrop to paint the surrounding whitespace with a style (Lip Gloss Place-style), e.g. a dimmed area behind a dialog.
The parameter is backdrop, not fill, because Element.fill already means something else in every snippet this appears in: there it is the layout extension that claims a row's or column's leftover space.
Each axis is named in its own vocabulary: horizontal takes Alignment (Left/Center/Right, the same enum Block titles and Paragraph text use) and vertical takes VerticalAlignment (Top/Middle/Bottom).
Attributes
The application shell: optional top bar, optional sidebar (left or right of the content), the content filling the middle, and an optional status bar.
The application shell: optional top bar, optional sidebar (left or right of the content), the content filling the middle, and an optional status bar.
Attributes
Side pane + main pane.
Side pane + main pane.
The pane is pane, not side, because Side and Sidebar.side fifty lines above already own that word for which edge; one name for two ideas in one file is a reading trap.
Attributes
A one-row status bar of key description hints over the theme surface.
A one-row status bar of key description hints over the theme surface.
Attributes
A one-row title bar over the theme surface: title left, optional tabs center, optional right-side text.
A one-row title bar over the theme surface: title left, optional tabs center, optional right-side text.
Attributes
Where the node this call belongs to was painted on the last frame — None on the first frame, and whenever the node was not on screen.
Where the node this call belongs to was painted on the last frame — None on the first frame, and whenever the node was not on screen.
"This node" is the one carrying the key of the innermost each row or keyed scope around the call: each gives the row's element that key by itself; inside keyed(k), give the element .key(k). Outside any keyed scope there is no node to answer for, and the answer is None. The rect is the one boundsOf(key) reports — translated out of scroll views, not clipped.
Asking switches the host's bounds recording on, and a frame whose node landed somewhere other than what the call answered asks for one more frame, so a view that sizes its content by its own area settles one frame after a move.
Attributes
Runs start after the frame that reached this call has been painted, and again — cancelling the previous run first — whenever deps differ (==, element by element) from the ones it last started with. The Cancelable it returns is cancelled when the call stops being reached, when the host is reset, and when the app stops.
Runs start after the frame that reached this call has been painted, and again — cancelling the previous run first — whenever deps differ (==, element by element) from the ones it last started with. The Cancelable it returns is cancelled when the call stops being reached, when the host is reset, and when the app stops.
def clock(using ReactiveScope, Theme): Element =
val now = useSignal(LocalTime.now())
useEffect()(Async.every(1.second)(now.set(LocalTime.now())))
text(now.get.toString)
A panel that polls while it is on screen stops polling the frame it disappears, including when a full-screen page covers it. Uncovering starts it again; ordinary eager useSignal/useState values in covered entries survive. No deps means "start once". start runs on the render thread, after the paint, so it may write signals (the write schedules a frame as usual) and read where things landed. A start that has nothing to release returns () => ().
Same ordering rule as every hook — see ViewState — and, like them, only callable while a view is evaluated: an event handler that wants a timer starts it itself and owns its Cancelable.
Attributes
compute, evaluated on the first frame that reaches this call and again only when deps change — the value-level counterpart of memo, for a derived value (a sorted copy, a parsed document) that is expensive to rebuild every frame. Unlike memo it is a hook: it insists on a view being evaluated, and follows the ordering rule on ViewState.
compute, evaluated on the first frame that reaches this call and again only when deps change — the value-level counterpart of memo, for a derived value (a sorted copy, a parsed document) that is expensive to rebuild every frame. Unlike memo it is a hook: it insists on a view being evaluated, and follows the ordering rule on ViewState.
Attributes
A Signal owned by this call site: created on the first frame that reaches this call, handed back unchanged on every later frame that reaches it, and dropped one frame after the call stops being reached.
A Signal owned by this call site: created on the first frame that reaches this call, handed back unchanged on every later frame that reaches it, and dropped one frame after the call stops being reached.
It is an ordinary Signal — writing it invalidates the view that read it and schedules a redraw, exactly as a Signal declared as a field on the app does. The only thing that changes is who owns it:
def counter(label: String)(using ReactiveScope, Theme): Element =
val count = useSignal(0)
row(text(s"$label: ${count.get}"), button("+")(count.update(_ + 1)))
initial is by-name and is evaluated only on the frame that creates the slot, so an expensive starting value costs nothing on later frames.
Read the ordering rule on ViewState before using this inside an if or a loop.
Attributes
A plain mutable value owned by this call site — the spelling for the caller-owned widget states (ListState, TextInputState, TreeState) that a reusable piece of view wants to keep private:
A plain mutable value owned by this call site — the spelling for the caller-owned widget states (ListState, TextInputState, TreeState) that a reusable piece of view wants to keep private:
def searchBox(using ReactiveScope, Theme): Element =
input(useState(TextInputState()))
The slot itself is not reactive, but the widget states are: each is io.worxbend.tui.core.Versioned, and the host watches the ones it painted, so a mutation made outside the event path — on the render thread — is drawn on the next loop iteration, exactly as it is for a state the app declares as a field.
create is by-name and runs only on the frame that creates the slot.
Attributes
Runs work on a background worker and answers its progress: Loadable.Loading until the result arrives on the render thread, then Loadable.Ready or Loadable.Failed; the arrival schedules the frame that shows it.
Runs work on a background worker and answers its progress: Loadable.Loading until the result arrives on the render thread, then Loadable.Ready or Loadable.Failed; the arrival schedules the frame that shows it.
def details(id: Long)(using ReactiveScope, Theme): Element =
useTask(id)(api.fetch(id)) match
case Loadable.Loading => spinner()
case Loadable.Ready(record) => text(record.title)
case Loadable.Failed(error) => text(error.getMessage)
The work starts on the first frame that reaches the call and again when deps change; a change cancels the run in flight, so only the newest start is ever delivered. The task belongs to a TaskScope the call site owns, closed when the call stops being reached — a result that arrives after its node has gone is never delivered. Cancellation follows TaskScope's contract: best effort, the work itself is not interrupted.
On a host without a render loop (print mode, Snapshot.render) nothing is started and the answer stays Loading.
Attributes
The which-key popup: while a key sequence is half typed, a bordered box titled with the prefix that lists every key that may follow it and what that key does — None when no prefix is pending or nothing continues it.
The which-key popup: while a key sequence is half typed, a bordered box titled with the prefix that lists every key that may follow it and what that key does — None when no prefix is pending or nothing continues it.
The box is a Element.portal placed against the bottom-right corner of an area of size, one row clear of the bottom edge so a statusBar stays readable, which is how TuiApp lays it over the composed view on every frame a prefix is pending (switch that off with override def whichKey = false). Call it directly only to place the popup in a view of your own.
A pure builder over the bindings value it is handed — activeBindings, so the prefix is the live one — and the ambient Theme.
Attributes
Pushes a default style onto a whole subtree (terminus's auto-restoring foreground.green { … }): every style-aware descendant renders with transform(Style.Default) as its base, with any style the node set itself layered on top, so a child's own colour wins and a child's notBold opts out of an inherited bold. Style-ignoring leaves (raw widget(...), images) are unaffected.
Pushes a default style onto a whole subtree (terminus's auto-restoring foreground.green { … }): every style-aware descendant renders with transform(Style.Default) as its base, with any style the node set itself layered on top, so a child's own colour wins and a child's notBold opts out of an inherited bold. Style-ignoring leaves (raw widget(...), images) are unaffected.
A cascade, not a rewrite: the subtree is wrapped as it is, and the style reaches each node when the frame is painted — the focus pass, which already rebuilds every node once per frame, layers the inherited style in on the same visit. Wrapping a thousand-node subtree therefore allocates one node, not a thousand, and nested scopes layer inner over outer. Layout builders (.fill, .length(n), .key(...)) apply to the scope itself, which takes the wrapped subtree's constraint so the call is layout-neutral.
Attributes
Concrete fields
Extensions
Extensions
Alignment and inter-child spacing for the containers that lay children out along an axis — row, column, and panel, which stacks its children with the same widget column does.
Alignment and inter-child spacing for the containers that lay children out along an axis — row, column, and panel, which stacks its children with the same widget column does.
Typed to FlexContainer rather than to every element: text("x").center used to compile and do nothing, which is the kind of silence a fluent API should not have. Each call gives back the container's own type, so the builders chain in any order.
Attributes
How the space children leave over is distributed. Only bites when space is actually left over — a .fill child takes it all, deliberately.
How the space children leave over is distributed. Only bites when space is actually left over — a .fill child takes it all, deliberately.
Attributes
Alignment and inter-child spacing for the containers that lay children out along an axis — row, column, and panel, which stacks its children with the same widget column does.
Alignment and inter-child spacing for the containers that lay children out along an axis — row, column, and panel, which stacks its children with the same widget column does.
Typed to FlexContainer rather than to every element: text("x").center used to compile and do nothing, which is the kind of silence a fluent API should not have. Each call gives back the container's own type, so the builders chain in any order.
Attributes
Extra blank cells inserted between neighbouring children.
Extra blank cells inserted between neighbouring children.
Attributes
Alignment and inter-child spacing for the containers that lay children out along an axis — row, column, and panel, which stacks its children with the same widget column does.
Alignment and inter-child spacing for the containers that lay children out along an axis — row, column, and panel, which stacks its children with the same widget column does.
Typed to FlexContainer rather than to every element: text("x").center used to compile and do nothing, which is the kind of silence a fluent API should not have. Each call gives back the container's own type, so the builders chain in any order.
Attributes
Alignment and inter-child spacing for the containers that lay children out along an axis — row, column, and panel, which stacks its children with the same widget column does.
Alignment and inter-child spacing for the containers that lay children out along an axis — row, column, and panel, which stacks its children with the same widget column does.
Typed to FlexContainer rather than to every element: text("x").center used to compile and do nothing, which is the kind of silence a fluent API should not have. Each call gives back the container's own type, so the builders chain in any order.
Attributes
Alignment and inter-child spacing for the containers that lay children out along an axis — row, column, and panel, which stacks its children with the same widget column does.
Alignment and inter-child spacing for the containers that lay children out along an axis — row, column, and panel, which stacks its children with the same widget column does.
Typed to FlexContainer rather than to every element: text("x").center used to compile and do nothing, which is the kind of silence a fluent API should not have. Each call gives back the container's own type, so the builders chain in any order.
Attributes
Shorthands for the handful of transforms that appear in nearly every view, so line("press ", "q".bold, " to quit") reads as the sentence it is rather than as "q".styled(_.bold). Anything past these — a blink, a background and a foreground and two attributes — goes through styled, which is the general form and is not going anywhere.
Shorthands for the handful of transforms that appear in nearly every view, so line("press ", "q".bold, " to quit") reads as the sentence it is rather than as "q".styled(_.bold). Anything past these — a blink, a background and a foreground and two attributes — goes through styled, which is the general form and is not going anywhere.
Attributes
A styled run of text: "OK".styled(_.withFg(Color.Green)) is the Span the Element.line factory takes.
A styled run of text: "OK".styled(_.withFg(Color.Green)) is the Span the Element.line factory takes.
A plain extension method rather than an implicit Conversion, so no call site needs a language import — the same choice Layout.apply's Int | Double | Constraint overload makes. It lives in this package, not in tui-core beside Span itself, because an extension method is only found through an import of the scope that defines it: declared in core it would need a second import at every view, which is precisely the ceremony import io.worxbend.tui.dsl.* exists to remove.
Attributes
A styled run of text: "OK".styled(_.withFg(Color.Green)) is the Span the Element.line factory takes.
A styled run of text: "OK".styled(_.withFg(Color.Green)) is the Span the Element.line factory takes.
A plain extension method rather than an implicit Conversion, so no call site needs a language import — the same choice Layout.apply's Int | Double | Constraint overload makes. It lives in this package, not in tui-core beside Span itself, because an extension method is only found through an import of the scope that defines it: declared in core it would need a second import at every view, which is precisely the ceremony import io.worxbend.tui.dsl.* exists to remove.
Attributes
Foreground colour, spelled fg/bg as it is on an element and on Style itself.
Foreground colour, spelled fg/bg as it is on an element and on Style itself.
Attributes
A styled run of text: "OK".styled(_.withFg(Color.Green)) is the Span the Element.line factory takes.
A styled run of text: "OK".styled(_.withFg(Color.Green)) is the Span the Element.line factory takes.
A plain extension method rather than an implicit Conversion, so no call site needs a language import — the same choice Layout.apply's Int | Double | Constraint overload makes. It lives in this package, not in tui-core beside Span itself, because an extension method is only found through an import of the scope that defines it: declared in core it would need a second import at every view, which is precisely the ceremony import io.worxbend.tui.dsl.* exists to remove.
Attributes
A styled run of text: "OK".styled(_.withFg(Color.Green)) is the Span the Element.line factory takes.
A styled run of text: "OK".styled(_.withFg(Color.Green)) is the Span the Element.line factory takes.
A plain extension method rather than an implicit Conversion, so no call site needs a language import — the same choice Layout.apply's Int | Double | Constraint overload makes. It lives in this package, not in tui-core beside Span itself, because an extension method is only found through an import of the scope that defines it: declared in core it would need a second import at every view, which is precisely the ceremony import io.worxbend.tui.dsl.* exists to remove.
Attributes
A styled run of text: "OK".styled(_.withFg(Color.Green)) is the Span the Element.line factory takes.
A styled run of text: "OK".styled(_.withFg(Color.Green)) is the Span the Element.line factory takes.
A plain extension method rather than an implicit Conversion, so no call site needs a language import — the same choice Layout.apply's Int | Double | Constraint overload makes. It lives in this package, not in tui-core beside Span itself, because an extension method is only found through an import of the scope that defines it: declared in core it would need a second import at every view, which is precisely the ceremony import io.worxbend.tui.dsl.* exists to remove.
Attributes
A styled run of text: "OK".styled(_.withFg(Color.Green)) is the Span the Element.line factory takes.
A styled run of text: "OK".styled(_.withFg(Color.Green)) is the Span the Element.line factory takes.
A plain extension method rather than an implicit Conversion, so no call site needs a language import — the same choice Layout.apply's Int | Double | Constraint overload makes. It lives in this package, not in tui-core beside Span itself, because an extension method is only found through an import of the scope that defines it: declared in core it would need a second import at every view, which is precisely the ceremony import io.worxbend.tui.dsl.* exists to remove.
Attributes
Which of the two carets a focused text node shows — see CaretStyle. Defined for every element so that the builder chains like any other, but read only by the text-entry nodes; on anything else it is inert.
Which of the two carets a focused text node shows — see CaretStyle. Defined for every element so that the builder chains like any other, but read only by the text-entry nodes; on anything else it is inert.
Attributes
effect played over this element's cells only, at elapsed into it: flash this panel, dissolve this toast, sweep in this dialog. The caller owns the clock — pass the time since the effect should have started — which is what keeps a frame of it reproducible in a test. For an effect timed from the element's first appearance, use the overload without elapsed.
effect played over this element's cells only, at elapsed into it: flash this panel, dissolve this toast, sweep in this dialog. The caller owns the clock — pass the time since the effect should have started — which is what keeps a frame of it reproducible in a test. For an effect timed from the element's first appearance, use the overload without elapsed.
Attributes
Ergonomic key handlers that hide the true/false stop-propagation ceremony.
Ergonomic key handlers that hide the true/false stop-propagation ceremony.
onKey binds an action to one or more keys; it consumes the event only when a bound key matches, delegating anything else to a handler already on the element — so several .onKey(…) calls compose instead of overwriting each other. Use Element.onKeyEvent directly when a handler needs the raw event or conditional consumption.
Like the styling and layout builders it gives back the element's own type, so panel(…).onKey(Key.Enter){…}.rounded still sees a PanelElement and the panel-only builders stay reachable after the binding.
Attributes
A mouse press inside this element (MouseEventKind.Down).
A mouse press inside this element (MouseEventKind.Down).
This is the same press the framework's own click-to-activate behavior reacts to, and a handler here runs first, so a click bound this way consumes the press and the built-in behavior does not also fire.
Attributes
The pointer moved with a button held down (MouseEventKind.Drag).
The pointer moved with a button held down (MouseEventKind.Drag).
Attributes
The button came back up (MouseEventKind.Up) — the end of a drag, and where a drag gesture is committed.
The button came back up (MouseEventKind.Up) — the end of a drag, and where a drag gesture is committed.
Attributes
The pointer moved over this element with no button held (MouseEventKind.Moved).
The pointer moved over this element with no button held (MouseEventKind.Moved).
Only terminals with any-motion reporting turned on deliver these. On the others the element simply never hears one, so a hover cue must never be the only way to reach something.
Attributes
A mouse handler that is told where the element is: a MouseContext carrying the event, the position relative to the element's top-left cell (ctx.local, (0, 0) at the corner) and the element's laid-out area. Prefer it to Element.onMouseEvent, whose absolute coordinates leave a handler to subtract an origin it was never given.
A mouse handler that is told where the element is: a MouseContext carrying the event, the position relative to the element's top-left cell (ctx.local, (0, 0) at the corner) and the element's laid-out area. Prefer it to Element.onMouseEvent, whose absolute coordinates leave a handler to subtract an origin it was never given.
true consumes the event, false lets it keep bubbling, and several handlers compose, the most recent first. A press this handler consumes captures the pointer, so the drags and the release that follow arrive here even when the pointer has left the element; ctx.event.clickCount is 2 for a double click.
canvas(width, height)(draw).onMouse { ctx =>
if ctx.event.kind == MouseEventKind.Down then { plot(ctx.local); true } else false
}
Attributes
Wheel steps: up runs on MouseEventKind.ScrollUp and down on MouseEventKind.ScrollDown.
Wheel steps: up runs on MouseEventKind.ScrollUp and down on MouseEventKind.ScrollDown.
Both directions are taken together rather than as two separate builders because a wheel that scrolls one way and not the other is a bug, not a feature — asking for both makes forgetting one impossible.
Attributes
The mouse pointer to show over this element and everything inside it — OSC 22, a hand over something clickable, an I-beam over something that takes typing. button, link, the text inputs and splitPane's divider already ask for theirs; this is for a custom clickable (.onClick on a text) or to overrule a default.
The mouse pointer to show over this element and everything inside it — OSC 22, a hand over something clickable, an I-beam over something that takes typing. button, link, the text inputs and splitPane's divider already ask for theirs; this is for a custom clickable (.onClick on a text) or to overrule a default.
Decoration only: a terminal without the protocol, or one the backend knows will swallow it, shows the ordinary pointer and nothing else changes. The app updates the shape on every mouse event it receives, so under the default button-only mouse capture it changes on a click or a drag; under all-motion tracking it follows the hover.
Attributes
Makes this element draggable, carrying payload: a press on it followed by motion starts a drag, a ghost of the element follows the pointer, and the release drops payload on the innermost dropTarget under it that takes it. A press and release without motion is still an ordinary click. The payload's type is its DragKey — the given in scope for A.
Makes this element draggable, carrying payload: a press on it followed by motion starts a drag, a ghost of the element follows the pointer, and the release drops payload on the innermost dropTarget under it that takes it. A press and release without motion is still an ordinary click. The payload's type is its DragKey — the given in scope for A.
Attributes
Makes this element a drop target for payloads of type A (by its DragKey) that accept takes: while a drag of one hovers it, the element draws the theme's focus cue, and a release over it calls onDrop with the value. A payload of another type, or one accept refuses, passes over it as if it were not there.
Makes this element a drop target for payloads of type A (by its DragKey) that accept takes: while a drag of one hovers it, the element draws the theme's focus cue, and a release over it calls onDrop with the value. A payload of another type, or one accept refuses, passes over it as if it were not there.
Attributes
Whether a mouse drag over this element selects its text. The text-showing nodes (text, markdown, log, logConsole, table, styledTable, dataTable) are selectable by default; .selectable(false) opts one out, together with everything inside it, and .selectable(true) opts any other node in. Selection only exists in an app that captures the mouse — without capture the terminal selects natively.
Whether a mouse drag over this element selects its text. The text-showing nodes (text, markdown, log, logConsole, table, styledTable, dataTable) are selectable by default; .selectable(false) opts one out, together with everything inside it, and .selectable(true) opts any other node in. Selection only exists in an app that captures the mouse — without capture the terminal selects natively.
Attributes
Asks for the keyboard when this element first appears — a search box on a screen that opens, the first field of a form, the default button of a dialog. Without it, focus starts on whichever focusable happens to come first in the tab order, and an app that wanted otherwise had to reach into the framework's own focus bookkeeping, which is not public.
Asks for the keyboard when this element first appears — a search box on a screen that opens, the first field of a form, the default button of a dialog. Without it, focus starts on whichever focusable happens to come first in the tab order, and an app that wanted otherwise had to reach into the framework's own focus bookkeeping, which is not public.
It fires once, on the frame the element appears in, and never again while it stays in the tree: an element that re-claimed focus every frame would make Tab useless, because the next render would take the keyboard straight back. It also opts the element into the tab order, the way .focusable does, so it works on a non-interactive element too.
Pair it with key. "Has this element appeared?" is answered by the focus key when there is one and by the element's position in the tab order otherwise, so an unkeyed autofocusing element that moves — because something above it appeared — reads as a new element and claims focus a second time.
If two elements ask at once, the first in the tab order wins.
Attributes
Slow blink. Widely ignored, and disabled outright in some terminals and by some accessibility settings, so never carry meaning in it alone — pair it with a colour or a word.
Slow blink. Widely ignored, and disabled outright in some terminals and by some accessibility settings, so never carry meaning in it alone — pair it with a colour or a word.
Attributes
Disables this element and everything inside it while condition holds: the subtree leaves the tab order (Tab skips it, focusTo refuses it), none of its handlers or built-in behaviours run — a click on a disabled button neither activates it nor moves focus, though it still lands there rather than falling through to what is drawn underneath — and every interactive node in it draws in the theme's disabled style. The pointer over it is PointerShape.NotAllowed. A disabled node stays in the tree and keeps painting, so the layout does not shift; the element-tree snapshot marks it disabled.
Disables this element and everything inside it while condition holds: the subtree leaves the tab order (Tab skips it, focusTo refuses it), none of its handlers or built-in behaviours run — a click on a disabled button neither activates it nor moves focus, though it still lands there rather than falling through to what is drawn underneath — and every interactive node in it draws in the theme's disabled style. The pointer over it is PointerShape.NotAllowed. A disabled node stays in the tree and keeps painting, so the layout does not shift; the element-tree snapshot marks it disabled.
condition is the usual shape: button("Save")(save()).disabled(!form.isValid).
Attributes
Opts a non-interactive element into the tab order (interactive elements are focusable by default).
Opts a non-interactive element into the tab order (interactive elements are focusable by default).
Attributes
Paints the text in the background colour, so it occupies its cells but cannot be read — a password field's masking, a spoiler. It is not a security measure: the characters are still in the terminal's buffer and are still copied by a selection.
Paints the text in the background colour, so it occupies its cells but cannot be read — a password field's masking, a spoiler. It is not a security measure: the characters are still in the terminal's buffer and are still copied by a selection.
Attributes
The style layered over this element while the pointer rests on it. Needs mouse-motion tracking, which a TuiApp turns on by itself once a frame asks for a hover cue — see RunnerConfig.withMouse(MouseCaptureMode.AllMotion) for an embedding host. Only the innermost target under the pointer is hovered, so a container's cue shows where none of its children is.
The style layered over this element while the pointer rests on it. Needs mouse-motion tracking, which a TuiApp turns on by itself once a frame asks for a hover cue — see RunnerConfig.withMouse(MouseCaptureMode.AllMotion) for an embedding host. Only the innermost target under the pointer is hovered, so a container's cue shows where none of its children is.
Attributes
Fluent styling — each call returns a new element of the same type, so the builders chain in any order.
Fluent styling — each call returns a new element of the same type, so the builders chain in any order.
Attributes
Turning an attribute off, which is not the same as never turning it on.
Turning an attribute off, which is not the same as never turning it on.
A Style records what it was asked to clear as well as what it was asked to set, so .notBold on a child of a bold container removes the bold rather than being ignored the way a Style.Default would be. Without these, an element inside a styled ancestor had no way to opt out of one attribute while keeping the rest.
Attributes
Fluent styling — each call returns a new element of the same type, so the builders chain in any order.
Fluent styling — each call returns a new element of the same type, so the builders chain in any order.
Attributes
Fluent styling — each call returns a new element of the same type, so the builders chain in any order.
Fluent styling — each call returns a new element of the same type, so the builders chain in any order.
Attributes
Fluent styling — each call returns a new element of the same type, so the builders chain in any order.
Fluent styling — each call returns a new element of the same type, so the builders chain in any order.
Attributes
Fluent styling — each call returns a new element of the same type, so the builders chain in any order.
Fluent styling — each call returns a new element of the same type, so the builders chain in any order.
Attributes
Fluent styling — each call returns a new element of the same type, so the builders chain in any order.
Fluent styling — each call returns a new element of the same type, so the builders chain in any order.
Attributes
Fluent styling — each call returns a new element of the same type, so the builders chain in any order.
Fluent styling — each call returns a new element of the same type, so the builders chain in any order.
Attributes
A handler returning true consumes the event; false lets it continue to the next candidate.
A handler returning true consumes the event; false lets it continue to the next candidate.
Handlers compose rather than replace one another: the most recently added runs first, and its false falls through to whatever was already on the element. That is what lets a helper hand back an element with a binding on it and a call site add a second binding without silently erasing the first — which is what a plain overwrite did, with no error and no warning to say so. onKey in Grammar has always composed this way; this is the raw builder catching up with it.
Attributes
A handler for a key coming back up, composing with any already on the element exactly as onKeyEvent does.
A handler for a key coming back up, composing with any already on the element exactly as onKeyEvent does.
Best-effort by nature. A release only exists when the application set RunnerConfig.keyEventTypes and the terminal speaks the kitty keyboard protocol; everywhere else this handler is simply never called, so it belongs on features that enrich an interaction (releasing a held key to stop a repeat, say) and never on the only path to an action.
A release is offered to the focused element and its ancestors and nowhere else: no built-in behaviour runs for it, and it does not reach TuiApp.bindings.
Attributes
A mouse handler, composing with any already on the element exactly as onKeyEvent does.
Handles paste on the focused leaf before its default behavior; paste never invokes app bindings.
Handles paste on the focused leaf before its default behavior; paste never invokes app bindings.
Attributes
The style layered over this element from a button going down on it to the release, wherever that lands.
The style layered over this element from a button going down on it to the release, wherever that lands.
Attributes
Keeps Tab and Shift+Tab inside this subtree while focus is in it — for a popover or an inline editor that is not a modal layer but should still hold the keyboard until it is dismissed. Focus gets in the usual ways (a click, .autofocus, focusTo); getting out is the app's call, by moving focus from code or removing the subtree. A pushed modal Screen needs none of this: the layer below it is already out of the tab order.
Keeps Tab and Shift+Tab inside this subtree while focus is in it — for a popover or an inline editor that is not a modal layer but should still hold the keyboard until it is dismissed. Focus gets in the usual ways (a click, .autofocus, focusTo); getting out is the app's call, by moving focus from code or removing the subtree. A pushed modal Screen needs none of this: the layer below it is already out of the tab order.
Attributes
Draws this element as role from the app's theme instead of its node type's own role — button("Save")(save()).variant(ButtonRole.Primary). The styles are looked up when the frame is painted, with the hierarchical fallback Theme.component describes, so a theme with nothing for the role draws the element as it would have been drawn without the call.
Draws this element as role from the app's theme instead of its node type's own role — button("Save")(save()).variant(ButtonRole.Primary). The styles are looked up when the frame is painted, with the hierarchical fallback Theme.component describes, so a theme with nothing for the role draws the element as it would have been drawn without the call.
Attributes
Back to the terminal's own default background colour.
Back to the terminal's own default background colour.
Attributes
Back to the terminal's own default foreground colour, whatever the surrounding elements set. The counterpart of fg, and the colour equivalent of the not* builders above.
Back to the terminal's own default foreground colour, whatever the surrounding elements set. The counterpart of fg, and the colour equivalent of the not* builders above.
Attributes
The element's whole area cleared to fill first, with fill layered under whatever the element drew — a background that the element's own colours still win over.
The element's whole area cleared to fill first, with fill layered under whatever the element drew — a background that the element's own colours still win over.
Attributes
A frame on all four sides in the theme's border style — text("hi").border(), .border(BorderType.Rounded). The panel-free way to box a single node; a panel adds a title, captions and slots on top of this.
A frame on all four sides in the theme's border style — text("hi").border(), .border(BorderType.Rounded). The panel-free way to box a single node; a panel adds a title, captions and slots on top of this.
Attributes
Keeps whatever the element paints inside the area it is handed: a hand-written widget that strays outside its rect is cut off at the edge rather than drawing over its neighbours. A portal inside escapes all the same — it paints at the frame root, which is what a portal is for.
Keeps whatever the element paints inside the area it is handed: a hand-written widget that strays outside its rect is cut off at the edge rather than drawing over its neighbours. A portal inside escapes all the same — it paints at the frame root, which is what a portal is for.
Attributes
Blank cells around the element, per side — what panel(...).borderless.padded(...) was written for.
Blank cells around the element, per side — what panel(...).borderless.padded(...) was written for.
Attributes
The default drop shadow, one cell down and to the right, dimming what is behind it. The element gives up that column and row of its area to the shadow, which never paints outside the area.
The default drop shadow, one cell down and to the right, dimming what is behind it. The element gives up that column and row of its area to the shadow, which never paints outside the area.
Attributes
Puts this child in the named area of the enclosing grid's .areas(...) template.
Puts this child in the named area of the enclosing grid's .areas(...) template.
Attributes
Puts this child's top-left corner at track row, col of the enclosing grid (both from zero).
Puts this child's top-left corner at track row, col of the enclosing grid (both from zero).
Attributes
Where this element sits across its container's axis — horizontally in a column, vertically in a row — instead of the container's own .alignItems(...). Anything but CrossAlign.Stretch shrinks it to its measured size, and an element that cannot measure itself stretches whatever is asked.
Where this element sits across its container's axis — horizontally in a column, vertically in a row — instead of the container's own .alignItems(...). Anything but CrossAlign.Stretch shrinks it to its measured size, and an element that cannot measure itself stretches whatever is asked.
Attributes
Exactly as big as the content measures along the container's axis — its Element.intrinsicHeight in a column, its Element.intrinsicWidth in a row — or a .fill when the content cannot say.
Exactly as big as the content measures along the container's axis — its Element.intrinsicHeight in a column, its Element.intrinsicWidth in a row — or a .fill when the content cannot say.
Attributes
Asks the enclosing scrollView to scroll this element into view on the frame it appears or is first marked — the selected row of a long list, the line a search landed on. Marking it again on later frames does not pull the view back each time, so the reader can still scroll away; take the mark off and put it back to ask again.
Asks the enclosing scrollView to scroll this element into view on the frame it appears or is first marked — the selected row of a long list, the line a search landed on. Marking it again on later frames does not pull the view back each time, so the reader can still scroll away; take the mark off and put it back to ask again.
Attributes
Layout constraints — how much space the element claims inside its container.
Layout constraints — how much space the element claims inside its container.
Attributes
Layout constraints — how much space the element claims inside its container.
Layout constraints — how much space the element claims inside its container.
Attributes
A ceiling of cells; the mirror of minSize. On its own it is a Constraint.Max — leftover space up to the cap — and combined with a size it bounds that size.
A ceiling of cells; the mirror of minSize. On its own it is a Constraint.Max — leftover space up to the cap — and combined with a size it bounds that size.
Attributes
A floor of cells. On its own it is a Constraint.Min — the floor plus a share of the leftover. Combined with a size, before or after it — .minSize(20).maxSize(60).fill, .auto.minSize(8) — it bounds that size instead: the element gets what the size gives it, but never fewer than cells.
A floor of cells. On its own it is a Constraint.Min — the floor plus a share of the leftover. Combined with a size, before or after it — .minSize(20).maxSize(60).fill, .auto.minSize(8) — it bounds that size instead: the element gets what the size gives it, but never fewer than cells.
Attributes
Layout constraints — how much space the element claims inside its container.
Layout constraints — how much space the element claims inside its container.
Attributes
An exact fraction of the container: .ratio(1, 3) claims a third. The whole-number companion to percent, for the splits a percentage cannot say without truncating — Layout's own advice for exact thirds.
An exact fraction of the container: .ratio(1, 3) claims a third. The whole-number companion to percent, for the splits a percentage cannot say without truncating — Layout's own advice for exact thirds.
Attributes
Modifiers as suffixes, so any key in the Key vocabulary can carry any combination of them: Key.Left.ctrl, Key.Enter.alt, Key.f(5).shift, Key.char('p').ctrl.shift.
Modifiers as suffixes, so any key in the Key vocabulary can carry any combination of them: Key.Left.ctrl, Key.Enter.alt, Key.f(5).shift, Key.char('p').ctrl.shift.
Each one adds its modifier to whatever the key already had rather than replacing the set, so the calls chain in any order and applying the same one twice is harmless.
Whether a terminal can actually report a given combination is a separate question: on a terminal without the kitty keyboard protocol, Ctrl plus i, m, j, h or [ arrives as Tab, Enter, Enter, Backspace and Escape respectively — see io.worxbend.tui.core.KeyEvent.parse, which rejects those spellings outright.
Attributes
Modifiers as suffixes, so any key in the Key vocabulary can carry any combination of them: Key.Left.ctrl, Key.Enter.alt, Key.f(5).shift, Key.char('p').ctrl.shift.
Modifiers as suffixes, so any key in the Key vocabulary can carry any combination of them: Key.Left.ctrl, Key.Enter.alt, Key.f(5).shift, Key.char('p').ctrl.shift.
Each one adds its modifier to whatever the key already had rather than replacing the set, so the calls chain in any order and applying the same one twice is harmless.
Whether a terminal can actually report a given combination is a separate question: on a terminal without the kitty keyboard protocol, Ctrl plus i, m, j, h or [ arrives as Tab, Enter, Enter, Backspace and Escape respectively — see io.worxbend.tui.core.KeyEvent.parse, which rejects those spellings outright.
Attributes
Modifiers as suffixes, so any key in the Key vocabulary can carry any combination of them: Key.Left.ctrl, Key.Enter.alt, Key.f(5).shift, Key.char('p').ctrl.shift.
Modifiers as suffixes, so any key in the Key vocabulary can carry any combination of them: Key.Left.ctrl, Key.Enter.alt, Key.f(5).shift, Key.char('p').ctrl.shift.
Each one adds its modifier to whatever the key already had rather than replacing the set, so the calls chain in any order and applying the same one twice is harmless.
Whether a terminal can actually report a given combination is a separate question: on a terminal without the kitty keyboard protocol, Ctrl plus i, m, j, h or [ arrives as Tab, Enter, Enter, Backspace and Escape respectively — see io.worxbend.tui.core.KeyEvent.parse, which rejects those spellings outright.
Attributes
Any border glyph set by name, for code that picks one from a value rather than writing it out — a theme setting, a user preference, a match on some state. The three named builders above are shorthands for this.
Any border glyph set by name, for code that picks one from a value rather than writing it out — a theme setting, a user preference, a match on some state. The three named builders above are shorthands for this.
Attributes
A double-line border — the conventional "this box is important" cue.
A double-line border — the conventional "this box is important" cue.
Attributes
Joins this panel's border to any border already drawn where it lands, instead of overwriting it.
Joins this panel's border to any border already drawn where it lands, instead of overwriting it.
Two panels laid side by side share a column. By default the second one drawn simply wins there, which gives one straight wall but leaves the corners unjoined — the seam reads as ┐ above ┘ where a single frame would show ┬ above ┴. With MergeStrategy.Exact the two glyphs are combined into the one that shows both. Fuzzy does the same and additionally accepts a lighter joint where Unicode has no exact one, which is what a double-walled panel meeting a thick-walled one needs.
Merging only looks at what is already in the buffer, so it depends on draw order: the panel drawn second is the one that has something to join to.
Attributes
Rounded corners instead of square ones.
Rounded corners instead of square ones.
Attributes
A heavy single-line border (┏━┓): the same emphasis a double border gives, in one stroke rather than two, which reads better next to plain-bordered neighbours.
A heavy single-line border (┏━┓): the same emphasis a double border gives, in one stroke rather than two, which reads better next to plain-bordered neighbours.
Attributes
Places every child vertically inside the row by align; a child's own .alignSelf(...) overrides it.
Places every child vertically inside the row by align; a child's own .alignSelf(...) overrides it.
Attributes
A key sequence checked when the code is compiled: keyseq"g g", keyseq"ctrl+k ctrl+s", keyseq" f".
A key sequence checked when the code is compiled: keyseq"g g", keyseq"ctrl+k ctrl+s", keyseq" f".
The key"…" interpolator's counterpart for sequences. A spec KeySequence.parse rejects stops the build with the parser's message; a spec with a $ hole cannot be checked and is a compile error too — use KeySequence.parse for a spec read at run time. The checked spec is parsed once more when the expression first runs, which cannot fail.
Attributes
key"ctrl+s" — a key spec the compiler checks, giving back the KeyEvent it names.
key"ctrl+s" — a key spec the compiler checks, giving back the KeyEvent it names.
The same value KeyEvent.parse("ctrl+s") produces, except that a spec the parser rejects — ctlr+s, a key name that does not exist, a Ctrl combination no terminal can deliver — stops the build with the parser's own message rather than throwing when the binding is first declared. Pass it wherever a KeyEvent is taken: .onKey(key"ctrl+s") { … } on an element, or binding(key"ctrl+s", "ctrl+s", "save") { … }.
Written out here rather than exported for a mechanical reason: an extension method on StringContext cannot be re-exported, so the one-import promise needs the forwarder. Its body is the same macro call tui-core declares, so there is one implementation and not two. Only a literal can be checked; a spec assembled at run time keeps going through KeyEvent.parse.
Attributes
markup"[bold red]error[/] in [link=$url]$file[/]" — a Text written as a literal with inline style tags, the tag names and their nesting checked by the compiler.
markup"[bold red]error[/] in [link=$url]$file[/]" — a Text written as a literal with inline style tags, the tag names and their nesting checked by the compiler.
Forwarded here for the same mechanical reason as key: an extension method on StringContext cannot be re-exported, and a styled message is written in every app's views. The body is the same macro call tui-core declares, so there is one implementation and not two. Show the result with text(markup"…"). The tag vocabulary is documented on the markup interpolator in io.worxbend.tui.core; an interpolated value is always text, never markup.
Attributes
Moves a numeric signal from its current value to target over duration, easing with easing, on the ticks the run already has — sugar over Tween for the value a view consumes, with no onTick and no elapsed counter.
Moves a numeric signal from its current value to target over duration, easing with easing, on the ticks the run already has — sugar over Tween for the value a view consumes, with no onTick and no elapsed counter.
private val ratio = Signal(0.0)
button("fill")(ratio.animateTo(1.0, 600.millis, Easing.CubicOut))
gauge(ratio.get)
Each tick samples the tween at the time elapsed since the start and sets the signal, so the view repaints through the ordinary reactive path; the last sample is exactly target. Starting another animateTo on the same signal replaces the motion in flight from wherever the value has got to. The returned handle stops the motion where it is.
Defined for Signal[Double] and Signal[Int] through AnimatedValue — an Int signal rounds each sample half up, so a scroll offset or a column width moves in whole cells and lands exactly on target.
Time is the run's own clock — the nanoTime handed to TuiApp.runWith, so a ManualClock steps it in tests — and ticks come from a configured tickRate when the app has one, and from the ambient ticker (the one that spins a spinner) otherwise, armed for as long as a motion is in flight. A non-positive duration, or a target equal to the current value, sets the target at once and returns a handle with nothing to cancel.
Render-thread only, like Signal.set itself: start it from a handler, a timer body or onStart, and cancel it from the same thread. Motions belong to the run that started them and are dropped when it ends.
Attributes
Exports
Defined exports
A sortable, filterable, pageable table: table is the data and column definitions, state is the view over it.
A sortable, filterable, pageable table: table is the data and column definitions, state is the view over it.
The state must be created once outside view — it holds the sort, the substring filter, the selection and the scroll offset, and rebuilding it every frame would reset all four. It is render-thread-only and writing to it does not by itself schedule a frame: see w.DataTableState.
Up/Down move the selection while focused, and PageUp/PageDown turn the page once state.paging is set. Sorting and filtering have no built-in keys on purpose — drive state.sortBy / state.setFilter from the app's own bindings, so the keys appear in the status bar and the palette.
Each row is a w.KeyedRow, so the selection follows the record across re-sorts and data refreshes rather than the screen position it happened to occupy; table.selectedKey(state) reads back which record that is without parsing its own formatted cells. w.DataTable.fromStrings builds the table from plain text rows when the records have no identity of their own.
This is the one selection element whose highlight the theme does not reach: table is a widget value the caller built, so its highlightStyle is the caller's to set and overriding it here would silently discard an explicit choice. Pass options = DataTableOptions(highlightStyle = theme.focus) when building the w.DataTable to line it up with list and the rest.
Attributes
Flexible blank space (fills what siblings leave over).
Flexible blank space (fills what siblings leave over).
Attributes
A collapsible tree whose rows carry columns — build the w.TreeTable with the nodes, the column titles, a cells lookup by row key and the column widths. Up/Down select, Enter toggles, Right/Left expand/collapse. The state is the same w.TreeState a tree takes; key it with TreeState.keyed so the cells lookup and the expansion follow a node across a refresh.
A collapsible tree whose rows carry columns — build the w.TreeTable with the nodes, the column titles, a cells lookup by row key and the column widths. Up/Down select, Enter toggles, Right/Left expand/collapse. The state is the same w.TreeState a tree takes; key it with TreeState.keyed so the cells lookup and the expansion follow a node across a refresh.