loom & weft
Made for Swift.

Published release 0.2.1. Unreleased PR #2 reference.

LOOM 0.2.1 / ADDITIONAL WIDGETS AND TEXT

Tabs

A single row of tabs.

Selection and event routing remain caller-owned. Overflow starts at the selected tab when it would otherwise be clipped.

Standard inherited Swift protocol operations such as synthesized equality and OptionSet set operations are not repeated. The public declarations below are extracted from the exact source revision listed in the coverage manifest.

Members on this page

Feature guides and release status

Tabs

Structure
struct Tabs<ID> where ID : Hashable, ID : Sendable

Conforms to: Widget.

A single row of tabs.

Selection and event routing remain caller-owned. Overflow starts at the selected tab when it would otherwise be clipped.

Source · Tabs.swift:16

tabs

Instance Property
var tabs: [Tab<ID>]

A public field of this type. Its value type and mutability are shown in the declaration.

Source · Tabs.swift:17

selected

Instance Property
var selected: ID?

A public field of this type. Its value type and mutability are shown in the declaration.

Source · Tabs.swift:18

separator

Instance Property
var separator: String

A public field of this type. Its value type and mutability are shown in the declaration.

Source · Tabs.swift:19

padding

Instance Property
var padding: Int

Padding between border and content.

Source · Tabs.swift:20

style

Instance Property
var style: Style

Visual attributes used when painting this value.

Source · Tabs.swift:21

selectedStyle

Instance Property
var selectedStyle: Style

A public field of this type. Its value type and mutability are shown in the declaration.

Source · Tabs.swift:22

init(_:selected:separator:padding:style:selectedStyle:)

Initializer
init(_ tabs: [Tab<ID>], selected: ID? = nil, separator: String = "│", padding: Int = 1, style: Style = Style(), selectedStyle: Style = Style(reversed: true))

Creates a value with the supplied arguments. Default arguments are shown in the declaration.

Parameters (6)
tabs
Argument type and any default are shown in the declaration; see the behavior notes above.
selected
Argument type and any default are shown in the declaration; see the behavior notes above.
separator
Argument type and any default are shown in the declaration; see the behavior notes above.
padding
Argument type and any default are shown in the declaration; see the behavior notes above.
style
Text/cell appearance.
selectedStyle
Argument type and any default are shown in the declaration; see the behavior notes above.
Source · Tabs.swift:24

hitTest(_:in:)

Instance Method
func hitTest(_ point: Point, in area: Rect) -> ID?

Returns the tab occupying a painted label or padding cell; separators have no target.

Parameters (2)
point
Zero-based terminal-cell position.
in
Argument type and any default are shown in the declaration; see the behavior notes above.

Returns ID?.

Source · Tabs.swift:37

render(in:buffer:)

Instance Method
func render(in area: Rect, buffer: inout Buffer)

Paints this widget into the assigned terminal-cell rectangle. Application code owns state, input routing, and terminal lifetime.

Parameters (2)
in
Argument type and any default are shown in the declaration; see the behavior notes above.
buffer
Mutable destination cell grid.
Source · Tabs.swift:42