Separator

termflow.tui.widgets.Separator
object Separator

Single-cell-thick line used to visually separate two regions.

Renders a horizontal or vertical run of the active theme's BorderChars glyphs (defaulting to the same style used by box borders). Optionally embeds a centred title in the run, in which case the line is broken with a small leader / trailer:

──── Title ────

The widget is purely presentational — it owns no state and emits a single TextNode. Apps typically place it between rows in a Layout.column or between columns in a Layout.row:

given Theme = Theme.dark
Layout.column(gap = 0)(
 Header(...),
 Separator.horizontal(width = 80),
 Body(...)
)

Alignment within a multi-cell row / column is the caller's job; the separator just draws the line at the supplied at.

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type
Separator.type

Members list

Type members

Classlikes

enum Direction

Direction of the separator.

Direction of the separator.

Attributes

Supertypes
trait Enum
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Value members

Concrete methods

def horizontal(width: Int, at: Coord, title: String, chars: BorderChars)(using theme: Theme): List[VNode]

Horizontal separator of width cells.

Horizontal separator of width cells.

Value parameters

at

Top-left cell. Defaults to (1, 1).

chars

Glyph set to draw with. Defaults to the theme's chars.

title

Optional centred title. Rendered with the theme's primary slot; the surrounding rule uses the theme's border slot. If width cannot fit the title plus at least one cell of leader / trailer the title is dropped and the rule fills the row.

width

Length of the run in cells. width <= 0 yields no node (returns an empty list), which keeps Layout.column composition simple.

Attributes

def vertical(height: Int, at: Coord, chars: BorderChars)(using theme: Theme): List[VNode]

Vertical separator of height cells.

Vertical separator of height cells.

Emits one single-character TextNode per row — the simplest model given the renderer's row-per-text-node convention. Like horizontal, a non-positive height yields no nodes.

Value parameters

at

Top-left cell. Defaults to (1, 1).

chars

Glyph set to draw with. Defaults to the theme's chars.

height

Number of cells in the run.

Attributes