Element

io.worxbend.tui.dsl.Element
See theElement companion object
trait Element

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
Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes
class BadgeElement
class DataTableElement[K]
class PanelElement
class RowElement
class TableElement
class FlowElement
class GaugeElement
class GridElement
class InputElement
class LineElement
class ListElement
class LogElement
class MenuElement
class TabsElement
class TextElement
class TreeElement
class TreeTableElement[K]
Show all

Members list

Type members

Types

type Self >: this.type <: Element

This node's own type, so a fluent extension gives back what it was handed: progressBar(0.5).fill.bare type-checks because .fill returns a ProgressBarElement, not an abstract Element. Every concrete node fixes it to itself with one line, type Self = ThatNodeType.

This node's own type, so a fluent extension gives back what it was handed: progressBar(0.5).fill.bare type-checks because .fill returns a ProgressBarElement, not an abstract Element. Every concrete node fixes it to itself with one line, type Self = ThatNodeType.

Attributes

Value members

Abstract methods

def widget: Widget

Concrete methods

def accessibleName: String

What this node is called when it is announced — button Save, checkbox agree — before the interaction states ElementHost.accessibleLabel appends. Defaults to debugName; a node with a label of its own says it.

What this node is called when it is announced — button Save, checkbox agree — before the interaction states ElementHost.accessibleLabel appends. Defaults to debugName; a node with a label of its own says it.

Attributes

def children: Seq[Element]
def debugName: String

The factory-style name of this node — panel, button, scrollView — for the element-tree snapshot and any other diagnostic that has to say what a node is without reflecting over its class. Every node type declares its own; a decorator answers with the name of the node it wraps. The default is only there so a node added without one still renders — ElementTreeSnapshotSpec fails the build until the override is written.

The factory-style name of this node — panel, button, scrollView — for the element-tree snapshot and any other diagnostic that has to say what a node is without reflecting over its class. Every node type declares its own; a decorator answers with the name of the node it wraps. The default is only there so a node added without one still renders — ElementTreeSnapshotSpec fails the build until the override is written.

Attributes

def pointerShape: Option[PointerShape]

The mouse pointer this node wants shown over it, when it wants one: the hand over a button or a link, the I-beam over a text field. None leaves the pointer as it is. An explicit .pointer(shape) on the node lands in props.pointerShape and takes precedence; the interactive nodes override this with their own default.

The mouse pointer this node wants shown over it, when it wants one: the hand over a button or a link, the I-beam over a text field. None leaves the pointer as it is. An explicit .pointer(shape) on the node lands in props.pointerShape and takes precedence; the interactive nodes override this with their own default.

Attributes

def style: Style
def style(style: Style): Self

This element with style as its own — the content style on every node: a text's text, a list's body, a panel's children and inner area. A container's border is frameStyle instead. The fluent builders (.fg, .bold, .styled(...)) edit the same style rather than replacing it.

This element with style as its own — the content style on every node: a text's text, a list's body, a panel's children and inner area. A container's border is frameStyle instead. The fluent builders (.fg, .bold, .styled(...)) edit the same style rather than replacing it.

Attributes