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
elbuilders, one per allowed tag.
Structs§
- Actions
- What a pointer does on a node:
{click?, dblclick?, menu?}. - Agent
agent: one subagent row.- Agent
Stats - An agent’s stats.
- Agent
Tool - The tool an agent runs now.
- Ansi
ansi: output with escape sequences.- Badge
badge: a pill chip.- Badge
Spec - A badge in a tool’s or agent’s head, or after a picker row’s label.
- Bound
- Size bounds
{w?, h?}forminandmax. - Card
card: a rounded card with a head and a body, optionally folding.- Chart
chart: bars, a sparkline or a heatmap.- Chart
Col - A heatmap column label.
- Checklist
checklist: a todo list.- Checklist
Item - A checklist item.
- Choice
Option - An option of a
prefschoice or multi control. - Code
code: highlighted code.- Code
Mark - A code line mark.
- Col
col: a vertical stack.- Column
- A
tablecolumn. - 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
prefsrow 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.
- Icon
Node 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
kvpair. - List
list: a selectable list ofitems.- Math
math: TeX math.- Md
md: Markdown.- Meter
meter: a value as a bar, ring or grid.- Meter
Cell - A table cell drawn as a meter.
- Meter
Mark - 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 inlayer.- 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).- Picker
Action - A picker action bar button.
- Picker
Column - A picker fact column.
- Picker
Item - A picker catalog item.
- Picker
Tab - A picker tab.
- Point
- One bar of a
barsorsparkchart. - Prefs
prefs: a settings page or sheet.- Prefs
Page - A
prefsnav page. - Prefs
Row - A
prefsrow. - Prefs
Section - A
prefssection. - 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.- Shimmer
Palette - 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.- Status
Bar status: a status bar strip ofsegs.- Strip
- A picker’s chip strip.
- Strip
Item - A switch chip of a picker strip.
- Tab
- A tab of a
tabsstrip. - Table
table: a table with priority-hidden columns and meter cells.- Table
Row - A
tablerow. - Tabs
tabs: a tab strip.- Text
Node 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.- Tool
Button - A hover button on a tool.
- Tree
tree: a disclosure tree.- Tree
Item - A
treeitem. - View
- A surface’s view: the root of each region (
main,dock,layer). A region left out is not shown.
Enums§
- Agent
Status - 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.
- Card
Variant - A card variant.
- Cell
- A table cell: text or a meter.
- Chart
Kind - Which chart.
- Checklist
Mode - A checklist’s presentation.
- Choice
Style - How a
prefschoice draws. - Column
Format - A picker column’s format.
- Control
- A
prefsrow’s control, byk. - Diff
Mode - How a diff lays out.
- Effort
Level - A thinking-effort rung.
- Elapsed
Format - 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.
- Input
Type - The type of an
elinput. - Item
Status - A checklist item’s state.
- Justify
- Main-axis distribution of a row’s or column’s children.
- KvLayout
- How a
kvlays out. - Mark
- A transient selection mark drawn over a node.
- Measure
- A text’s line-length cap.
- Meter
Style - A meter’s shape.
- NodeKey
- A node key: a string, or an integer named in decimal.
- Order
Entry - A picker
orderentry: an item id or a group header. - Overlay
Size - An overlay’s size.
- Picker
Focus - Which part of a picker the keys drive.
- Picker
Layout - A picker’s row template.
- Picker
Preview - Where a picker’s preview sits.
- Picker
Size - A picker sheet’s size.
- Picker
State - A picker’s state.
- Preview
- Lines a collapsed card shows.
- Shimmer
Mode - How a shimmer sweeps.
- Side
- Which group of a status strip a segment sits in.
- Size
- Small, medium or large.
- Spinner
Style - A spinner’s indicator.
- Status
- The state of a card or tool.
- Target
Kind - How a tool’s string target is drawn.
- Text
- Text given as a plain string or as styled spans.
- Text
Align - 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.
- Tool
Frame - A tool’s frame.
- Tool
Preview - 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§
- Card
Status - The status chip of a card (the same values as tools).