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§
- ActButton
- A button that sends
act: in a table’s selection bar (bar, sent with the picked ids asvalue), or attached to aninputoreditor(buttons;"copy"copies the text). - 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.- Ask
- The contents of a tool’s approval panel (
ask), drawn while its status isask. - AskScope
- A scope of a tool’s approval (how long the yes lasts).
- Attachment
attachment: a file attached to a message, with its upload state.- Avatar
avatar: a person, bot or org as initials, an icon or a picture.- Avatar
Item - One avatar of an
avatarsstack. - Avatars
avatars: avatars stacked, with an overflow count. Itsmaxis an avatar count, not the common size bounds.- 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. - Breadcrumb
breadcrumb: a trail of places, the last one current.- Button
button: a push button. A click sendsactionwithactions.click("click"by default); it never takes focus.- Button
Cell - A table cell drawn as a sm
button. Its click sends anactionevent withactand the row asitem, and doesn’t select the row. - Buttons
buttons:buttonchildren drawn as one group: joined, split or a toolbar.- Calendar
calendar: a month grid or a week strip of days.- Card
card: a rounded card with a head and a body, optionally folding.- Carousel
carousel: slides (its children) shown one at a time. A move by the user sendschangewith the index shown.- Chart
chart: bars, a sparkline, a heatmap, a line or area chart or a donut.- Chart
Col - A heatmap column label.
- Chart
Mark - A dashed reference line (a target, a limit) across a
bars,spark,lineorareachart. Outside the domain it is clamped to its edge. - Checklist
checklist: a todo list.- Checklist
Item - A checklist item.
- Choice
Option - An option of a
prefschoice or multi control. - Cite
- A source a span cites.
- Code
code: highlighted code.- Code
Fold - A run of lines a code block draws as one row until it is opened.
- Code
Mark - A code line mark.
- Col
col: a vertical stack.- Column
- A
tablecolumn. - Confirm
- A picker confirm strip.
- Crumb
- A crumb of a
breadcrumb. - Date
date: a date field that opens a calendar popover.- DayMark
- A day of a
calendarcarrying a dot. - 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.- Empty
empty: an empty state: icon, title, a line and its children (the actions). Itstitleis text, not a tooltip.- Field
field: a labelled form row around its control(s): label, hint, error or warning.- Frame
- A frame of a
stacktrace. - Frame
Code - A source excerpt of a
stacktraceframe. - Hunk
- A diff hunk given directly.
- Icon
Action - An icon button of a
messageor anattachment(actions). - 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.- Json
json: a JSON value Tern draws as a foldable tree.- 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.- Media
media: a file Tern loads by path and shows in its media viewer.- Menu
menu: a button that opens a menu of commands.- Menu
Item - A menu row. Choosing it sends
actionwithidasact(and the newcheckedof a check or radio row). - Menubar
menubar: a strip of menus.- Menubar
Menu - A menu of a
menubar. - Message
message: one chat message: author, body (its children), reactions and actions.- 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.
- Nav
nav: navigation links, some opening a menu or panel of sub-items. A pick sendsselectwith the item.- NavItem
- An item of a
nav. - NavSub
Item - A sub-item of a
navitem. - Node
- A node: a kind, props, children and handlers. It has no id until it is reconciled. Every kind’s builder converts into it.
- Otp
otp: a one-time code, one cell per character.- Overlay
overlay: a floating panel or sheet inlayer.- Pager
pager: pagination. A page click sendschangewith the page; themorerow sendsactionmore.- 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, one point of a one-serieslineorareachart, or one segment of adonut. - Prefs
prefs: a settings page or sheet.- Prefs
Page - A
prefsnav page. - Prefs
Row - A
prefsrow. - Prefs
Section - A
prefssection. - Preset
- A preset of a
weekcalendar. - Progress
progress: a progress bar (indeterminate without a value).- Question
- A question of a
questionsnode. - Question
Choice - A choice of a question.
- Questions
questions: a questionnaire.- Rate
rate: a number easing between updates.- Reaction
- A reaction chip of a
message. - 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.
- Scroll
scroll: a scrolling container, optionally pinned to its end. Scrolling is the viewer’s; it sends nothing.- Section
section: a lighter disclosure group.- Seg
seg: a status bar segment.- Select
select: a value picked from a menu, as a field or a quiet trigger, optionally searchable.- Select
Option - An option of a
select. - Series
- One line of a multi-series
lineorareachart. - Shimmer
shimmer: a shimmering label.- Shimmer
Palette - A shimmer’s sweep colors, as span tokens.
- Skeleton
skeleton: placeholder shapes while content loads.- Slider
slider: a value, or a range, dragged along a track.- Sort
- The column a
table’s rows are sorted by. - Source
- A source chip of a
traceor one of its lines. - Spacer
spacer: vertical space.- Span
- One styled run of text:
{t, s?, fx?, href?, cite?}. - Spark
Cell - A table cell drawn as a sparkline.
- Spinner
spinner: an activity indicator.- Split
split: panes (its children) the user resizes by dragging the handles between them.- Stack
Error - The error of a
stacktrace. - Stacktrace
stacktrace: an error and its stack frames.- Stat
Item - One tile of a
statswell. - Stats
stats: a well of stat tiles.- Status
Bar status: a status bar strip ofsegs.- Strip
- A picker’s chip strip.
- Strip
Item - A switch chip of a picker strip.
- Suggestion
- A prompt of a
suggestionsnode. - Suggestions
suggestions: suggested prompts. A click sendsactivatewith the item’s id (else its text).- Switch
switch: an on/off setting. A click flips it at once and sendschangewith the new state asvalue.- 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
Cell - A table cell: text with a status dot or icon before it.
- 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.
- Trace
trace: an agent’s steps, each opening in place.- Trace
Line - A step of a
trace. A child keyed by itsidis its content. - 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.
- Approved
- A tool’s resolved approval, shown as a head chip.
- AskAlways
- The Always button of a tool’s approval card.
- Attachment
State - An
attachment’s upload state. - Attachment
Variant - An
attachment’s look. - Avatar
Size - An avatar’s size.
- Avatar
Variant - An avatar’s shape.
- Basis
- A flex basis.
- Breadcrumb
Variant - A
breadcrumb’s look. - Button
Size - A
button’s height. - Button
Variant - A
button’s chrome. - Buttons
Variant - A
buttonsgroup’s look. - Calendar
Variant - A
calendar’s look. - Card
Variant - A card variant.
- Carousel
Variant - A
carousel’s look. - Cell
- A table cell: spans, a meter, decorated text, a badge, a button or a sparkline.
- Chart
Kind - Which chart.
- Checklist
Mode - A checklist’s presentation.
- Choice
Style - How a
prefschoice draws. - Cite
Style - How cited spans of a
textlook. - Column
Format - A picker column’s format.
- Control
- A
prefsrow’s control, byk. - Date
Value - A
calendar’s ordate’s selection: aYYYY-MM-DDday, or a range whose end may still be open. - Diff
Mode - How a diff lays out.
- Disabled
- Whether something is disabled:
true, or a reason shown as its tooltip. - Effort
Level - A thinking-effort rung.
- Elapsed
Format - How an elapsed timer reads.
- Empty
Variant - An
emptystate’s look. - Extent
- A size bound:
"<n>ch","<n>lines"or a fraction of the parent. - Field
Variant - A
field’s layout. - Fx
- A span effect.
- Gap
- Space between children, or a spacer’s height.
- Height
- A height in pixels or in the surface’s cells and lines.
- Icon
- A named icon from Tern’s icon set.
- Input
Type - The type of an
elinput. - Input
Variant - An
input’s oreditor’s look. - 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.
- Menu
Align - Which edge of its trigger a menu lines up with.
- Menu
Entry - An entry of a
menu, of amenubarmenu or ofactions.menu. - Menu
Variant - A
menu’s look. - Menubar
Variant - A
menubar’s look. - Message
Side - Which side a
messagesits on. - Message
Variant - A
message’s look. - Meter
Style - A meter’s shape.
- NavVariant
- A
nav’s look. - NodeKey
- A node key: a string, or an integer named in decimal.
- Noun
- What a
scroll’s counts name: one word made plural with ans, or both forms. - Order
Entry - A picker
orderentry: an item id or a group header. - Other
Answer - A question’s free-text answer: on, or on with a placeholder.
- OtpMask
- How an
otphides what was typed. - OtpState
- An
otp’s state. - OtpVariant
- An
otp’s look. - Overlay
Side - The edge an overlay docks to as a sheet or drawer.
- Overlay
Size - An overlay’s size.
- Overlay
Variant - How a docked overlay sits at its edge.
- Pager
Variant - A
pager’s look. - PaneMin
- The minimum size of a
split’s panes along the split. - 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.
- Question
Answer - An answer of a
questionsnode: a choice’s value or text, or the values of amultiquestion. - Questions
Variant - A
questions’s look. - Reveal
- When a
message’s action buttons show. - Rule
Variant - A
rule’s look. - Scroll
Bar - When a
scroll’s thumb shows. - Scroll
Variant - A
scroll’s look. - Select
Variant - A
select’s look. - Shimmer
Mode - How a shimmer sweeps.
- Side
- Which group of a status strip a segment sits in.
- Size
- Small, medium or large.
- Skeleton
Shape - What a
skeletonstands for. - Skeleton
Variant - A
skeleton’s look. - Slider
Format - How a
slider’s value reads. - Slider
Value - A
slider’s value: one, or a range drawn with two thumbs. - Slider
Variant - A
slider’s look. - Slot
- What a slot prop (
cardhead/end,sectionhead,overlayend/foot) holds: text, or a node drawn there. - SortDir
- A sort direction.
- Spinner
Style - A spinner’s indicator.
- Split
Dir - How a
splitlays out its panes. - Split
Variant - A
split’s look. - Stacktrace
Variant - A
stacktrace’s look. - Status
- The state of a card or tool.
- Stick
- Where a
scrollkeeps to while its content grows. - Suggestions
Variant - A
suggestions’s look. - Switch
Variant - A
switch’s look. - Table
Variant - How a
multitable’s picks and sort look. - Tabs
Variant - A
tabsstrip’s look. - 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.
- Text
Flag - Text, or a bare flag: a
field’serror/warning(truesets the state without a line), a chart’slast(trueprints the value,falsehides it). - Ticks
- A
slider’s tick marks. - Token
- A span style token (several join with spaces; palette tokens through
Other). - Tone
- The semantic color of a node’s chrome.
- Tool
Confirm - The approval look of a tool whose status is
ask. - Tool
Frame - A tool’s frame.
- Tool
Preview - The clamp of a collapsed tool body.
- Trace
Variant - A
trace’s look. - Truncate
- Where overflowing text is cut.
- Week
Start - The first column of a month grid.
- Wrap
- How text wraps.
Functions§
- agent
- A subagent row.
- ansi
- Terminal output.
- attachment
- An attached file named
name. - avatar
- An avatar of
text. - avatars
- A stack of avatars.
- badge
- A pill chip.
- breadcrumb
- A trail of places.
- button
- A push button labeled
text. - buttons
- A group of buttons.
- calendar
- A calendar.
- card
- A card.
- carousel
- Slides shown one at a time.
- chart
- A chart.
- checklist
- A todo list.
- code
- Highlighted code.
- col
- A vertical stack.
- date
- A date field.
- diff
- A diff.
- editor
- A multi-line text field.
- effort
- A thinking-effort glyph.
- elapsed
- A live timer.
- empty
- An empty state titled
title. - field
- A form row labeled
label. - icon
- A named icon.
- image
- An image.
- input
- A single-line text field.
- item
- A list row.
- json
- A JSON value Tern draws natively as an interactive tree. Check the hello
reply’s
kindsforjsonand fall back totreeotherwise. - kbd
- Keycaps (
["cmd", "K"]). - kv
- A key/value list.
- list
- A selectable list.
- math
- TeX math.
- md
- Markdown.
- media
- A file at
path(absolute, or relative to the pane’s working directory) in Tern’s media viewer. - menu
- A menu button.
- menubar
- A strip of menus.
- message
- A chat message.
- meter
- A meter.
- nav
- Navigation links.
- node
- A node of any kind (the untyped escape hatch).
- otp
- A one-time code of
lengthcells. - overlay
- A floating panel.
- pager
- Pagination.
- picker
- A picker sheet.
- prefs
- A settings page.
- progress
- A progress bar.
- questions
- A questionnaire.
- rate
- An easing number.
- row
- A horizontal flex row.
- rows
- Pre-rendered rows.
- rule
- A divider.
- scroll
- A scrolling container.
- section
- A section.
- seg
- A status bar segment.
- select
- A value picked from a menu.
- shimmer
- A shimmering label.
- skeleton
- Placeholder shapes.
- slider
- A slider.
- spacer
- Vertical space.
- span
- A styled span of text.
- spinner
- An activity indicator.
- split
- Resizable panes.
- stacktrace
- An error and its stack.
- stats
- A well of stat tiles.
- status
- A status bar strip.
- suggestions
- Suggested prompts.
- switch
- An on/off switch labeled
label. - table
- A table.
- tabs
- A tab strip.
- text
- Text, plain or styled.
- toast
- A transient notice.
- tool
- A tool call.
- trace
- An agent’s steps.
- tree
- A disclosure tree.
Type Aliases§
- Card
Status - The status chip of a card (the same values as tools).