Skip to main content

Module ui

Module ui 

Source
Expand description

Layer 3: nodes. Typed builders for every kind (except block, which is Tern’s own), every documented prop, the common props, styled spans and handlers that map events to the program’s messages.

Every builder converts into Node; containers take children with .child(…) / .children(…). Any prop can also be set untyped with .prop(name, value), and any kind built with node.

§Example

use tern_sdk::ui::{self, CardStatus, View};

#[derive(Clone)]
enum Msg {
	Rerun,
}

let view: View<Msg> = View::new().main([ui::card()
	.head("Deploy")
	.status(CardStatus::Running)
	.on_menu("rerun", Msg::Rerun)
	.child(ui::md("Uploading **api-gateway**"))
	.child(ui::progress().value(0.4).label("40%"))]);
assert!(view.regions()[0].is_some());

Modules§

html
el builders, one per allowed tag.

Structs§

Actions
What a pointer does on a node: {click?, dblclick?, menu?}.
Agent
agent: one subagent row.
AgentStats
An agent’s stats.
AgentTool
The tool an agent runs now.
Ansi
ansi: output with escape sequences.
Badge
badge: a pill chip.
BadgeSpec
A badge in a tool’s or agent’s head, or after a picker row’s label.
Bound
Size bounds {w?, h?} for min and max.
Card
card: a rounded card with a head and a body, optionally folding.
Chart
chart: bars, a sparkline or a heatmap.
ChartCol
A heatmap column label.
Checklist
checklist: a todo list.
ChecklistItem
A checklist item.
ChoiceOption
An option of a prefs choice or multi control.
Code
code: highlighted code.
CodeMark
A code line mark.
Col
col: a vertical stack.
Column
A table column.
Confirm
A picker confirm strip.
Decor
A styled range of an editor’s text (UTF-16 offsets).
Diff
diff: a unified or split diff.
Editing
The prefs row being edited with the keyboard.
Editor
editor: a multi-line text field whose text the program owns.
Effort
effort: a thinking-effort glyph.
Elapsed
elapsed: a live timer Tern clocks.
Hunk
A diff hunk given directly.
IconNode
icon: a named icon.
Image
image: an image from a blob.
Input
input: a single-line text field.
Item
item: one list row.
Kbd
kbd: keycaps.
Kv
kv: an aligned key/value list.
KvItem
One kv pair.
List
list: a selectable list of items.
Math
math: TeX math.
Md
md: Markdown.
Meter
meter: a value as a bar, ring or grid.
MeterCell
A table cell drawn as a meter.
MeterMark
A tick on a meter.
Node
A node: a kind, props, children and handlers. It has no id until it is reconciled. Every kind’s builder converts into it.
Overlay
overlay: a floating panel or sheet in layer.
Part
A stacked part of a meter or meter cell.
Phase
A checklist phase.
Picker
picker: a searchable picker sheet (its child is the preview).
PickerAction
A picker action bar button.
PickerColumn
A picker fact column.
PickerItem
A picker catalog item.
PickerTab
A picker tab.
Point
One bar of a bars or spark chart.
Prefs
prefs: a settings page or sheet.
PrefsPage
A prefs nav page.
PrefsRow
A prefs row.
PrefsSection
A prefs section.
Progress
progress: a progress bar (indeterminate without a value).
Rate
rate: a number easing between updates.
Retry
An agent’s retry countdown.
Row
row: a horizontal flex row.
Rows
rows: pre-rendered ANSI rows (the migration fallback).
Rule
rule: a divider hairline.
Scope
A picker scope.
Section
section: a lighter disclosure group.
Seg
seg: a status bar segment.
Shimmer
shimmer: a shimmering label.
ShimmerPalette
A shimmer’s sweep colors, as span tokens.
Spacer
spacer: vertical space.
Span
One styled run of text: {t, s?, fx?, href?}.
Spinner
spinner: an activity indicator.
StatusBar
status: a status bar strip of segs.
Strip
A picker’s chip strip.
StripItem
A switch chip of a picker strip.
Tab
A tab of a tabs strip.
Table
table: a table with priority-hidden columns and meter cells.
TableRow
A table row.
Tabs
tabs: a tab strip.
TextNode
text: styled spans, wrapped or truncated.
Thresholds
Fill levels that tint a meter.
Toast
toast: a transient notice.
Tool
tool: one coding-agent tool call.
ToolButton
A hover button on a tool.
Tree
tree: a disclosure tree.
TreeItem
A tree item.
View
A surface’s view: the root of each region (main, dock, layer). A region left out is not shown.

Enums§

AgentStatus
The state of an agent.
Align
Cross-axis alignment of a row’s or column’s children.
Anchor
Where an overlay floats.
Basis
A flex basis.
CardVariant
A card variant.
Cell
A table cell: text or a meter.
ChartKind
Which chart.
ChecklistMode
A checklist’s presentation.
ChoiceStyle
How a prefs choice draws.
ColumnFormat
A picker column’s format.
Control
A prefs row’s control, by k.
DiffMode
How a diff lays out.
EffortLevel
A thinking-effort rung.
ElapsedFormat
How an elapsed timer reads.
Extent
A size bound: "<n>ch", "<n>lines" or a fraction of the parent.
Fx
A span effect.
Gap
Space between children, or a spacer’s height.
Icon
A named icon from Tern’s icon set.
InputType
The type of an el input.
ItemStatus
A checklist item’s state.
Justify
Main-axis distribution of a row’s or column’s children.
KvLayout
How a kv lays out.
Mark
A transient selection mark drawn over a node.
Measure
A text’s line-length cap.
MeterStyle
A meter’s shape.
NodeKey
A node key: a string, or an integer named in decimal.
OrderEntry
A picker order entry: an item id or a group header.
OverlaySize
An overlay’s size.
PickerFocus
Which part of a picker the keys drive.
PickerLayout
A picker’s row template.
PickerPreview
Where a picker’s preview sits.
PickerSize
A picker sheet’s size.
PickerState
A picker’s state.
Preview
Lines a collapsed card shows.
ShimmerMode
How a shimmer sweeps.
Side
Which group of a status strip a segment sits in.
Size
Small, medium or large.
SpinnerStyle
A spinner’s indicator.
Status
The state of a card or tool.
TargetKind
How a tool’s string target is drawn.
Text
Text given as a plain string or as styled spans.
TextAlign
Text alignment in a table column.
Token
A span style token (several join with spaces; palette tokens through Other).
Tone
The semantic color of a node’s chrome.
ToolFrame
A tool’s frame.
ToolPreview
The clamp of a collapsed tool body.
Truncate
Where overflowing text is cut.
Wrap
How text wraps.

Functions§

agent
A subagent row.
ansi
Terminal output.
badge
A pill chip.
card
A card.
chart
A chart.
checklist
A todo list.
code
Highlighted code.
col
A vertical stack.
diff
A diff.
editor
A multi-line text field.
effort
A thinking-effort glyph.
elapsed
A live timer.
icon
A named icon.
image
An image.
input
A single-line text field.
item
A list row.
kbd
Keycaps (["cmd", "K"]).
kv
A key/value list.
list
A selectable list.
math
TeX math.
md
Markdown.
meter
A meter.
node
A node of any kind (the untyped escape hatch).
overlay
A floating panel.
picker
A picker sheet.
prefs
A settings page.
progress
A progress bar.
rate
An easing number.
row
A horizontal flex row.
rows
Pre-rendered rows.
rule
A divider.
section
A section.
seg
A status bar segment.
shimmer
A shimmering label.
spacer
Vertical space.
span
A styled span of text.
spinner
An activity indicator.
status
A status bar strip.
table
A table.
tabs
A tab strip.
text
Text, plain or styled.
toast
A transient notice.
tool
A tool call.
tree
A disclosure tree.

Type Aliases§

CardStatus
The status chip of a card (the same values as tools).