Published release 0.2.1. Unreleased PR #2 reference.
LOOM 0.2.1 / WIDGETS
Panel
Paints borders, rich top/bottom titles, and optional shadows. Render content separately inside inner(area). Negative padding contributes zero. BorderLayer merges shared edges explicitly. Titles require their border edge by default; title ordering and padding use whole-grapheme clipping.
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.
Example
var frame = Frame(width: 40, height: 8)
let panel = Panel(borderType: .rounded, title: "Status", padding: PanelPadding(all: 1))
frame.render(panel, in: frame.area)
let inner = panel.inner(frame.area)
frame.render(Paragraph(TextLayout("Ready", width: inner.width)), in: inner)Members on this page
Feature guides and release status
Panel
struct PanelConforms to: Swift.Sendable, Swift.SendableMetatype, Widget.
Draws selectable borders and an optional title around an inner content area.
Source · Panel.swift:98style
var style: StyleVisual attributes used when painting this value.
Source · Panel.swift:99borders
var borders: BorderEdgesEnabled border sides.
Source · Panel.swift:100borderType
var borderType: BorderTypeLine/corner glyph style for the border.
Source · Panel.swift:101title
var title: String?Optional title displayed in the top border.
Source · Panel.swift:102titleAlignment
var titleAlignment: PanelTitleAlignmentHorizontal placement of a panel’s title.
Source · Panel.swift:103padding
var padding: PanelPaddingPadding between border and content.
Source · Panel.swift:104titles
var titles: [PanelTitle]A public field of this type. Its value type and mutability are shown in the declaration.
Source · Panel.swift:105borderStyle
var borderStyle: Style?A public field of this type. Its value type and mutability are shown in the declaration.
Source · Panel.swift:106titleStyle
var titleStyle: Style?A public field of this type. Its value type and mutability are shown in the declaration.
Source · Panel.swift:107shadow
var shadow: PanelShadow?A public field of this type. Its value type and mutability are shown in the declaration.
Source · Panel.swift:108init(style:borders:borderType:title:titleAlignment:padding:titles:borderStyle:titleStyle:shadow:)
init(style: Style = Style(), borders: BorderEdges = .all, borderType: BorderType = .single, title: String? = nil, titleAlignment: PanelTitleAlignment = .left, padding: PanelPadding = PanelPadding(), titles: [PanelTitle] = [], borderStyle: Style? = nil, titleStyle: Style? = nil, shadow: PanelShadow? = nil)Creates a value with the supplied arguments. Default arguments are shown in the declaration.
Parameters (10)
style- Text/cell appearance.
borders- Argument type and any default are shown in the declaration; see the behavior notes above.
borderType- Argument type and any default are shown in the declaration; see the behavior notes above.
title- Argument type and any default are shown in the declaration; see the behavior notes above.
titleAlignment- 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.
titles- Argument type and any default are shown in the declaration; see the behavior notes above.
borderStyle- Argument type and any default are shown in the declaration; see the behavior notes above.
titleStyle- Argument type and any default are shown in the declaration; see the behavior notes above.
shadow- Argument type and any default are shown in the declaration; see the behavior notes above.
inner(_:)
func inner(_ area: Rect) -> RectReturns content geometry after border and padding cells have been removed.
Parameters (1)
area- Assigned absolute terminal-cell rectangle.
Returns Rect.
render(in:buffer:)
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.