Interactive macros create elements that respond to player input. Because they are asynchronous—their contents execute at a later time, after the player acts—there are two important things to keep in mind:Documentation Index
Fetch the complete documentation index at: https://mintlify.com/pompom454/tea/llms.txt
Use this file to discover all available pages before exploring further.
- If you use interactive macros inside a loop, wrap them in
<<capture>>to preserve the loop variable’s current value. - Reloading the page or revisiting a passage may not restore the state of interactive macros; design your stories with this in mind.
<<link linkText [passageName]>> … <</link>>
Creates an anchor (<a>) that silently executes its body when clicked, optionally navigating to another passage. Accepts plain text, link markup, or image markup as the first argument.
- Text + passage
- Link markup
- Image markup
- Optional class / id
The visible text of the link. May contain markup. Alternatively, pass link markup
[[…]] or image markup [img[…]] as the sole first argument.Optional. The passage to navigate to when clicked.
Optional. Space-separated class names to set on the link element.
Optional. Unique ID to assign to the link element.
<<button linkText [passageName]>> … <</button>>
Functionally identical to <<link>> but renders as a <button> element rather than an anchor. Accepts the same argument forms.
Inline reveal macros
These single-use links deactivate themselves when clicked and inject new content relative to the link text.<<linkappend linkText [transition|t8n]>> … <</linkappend>>
Appends the body content after the link text, then deactivates.
<<linkprepend linkText [transition|t8n]>> … <</linkprepend>>
Prepends the body content before the link text, then deactivates.
<<linkreplace linkText [transition|t8n]>> … <</linkreplace>>
Replaces the link text entirely with the body content, then deactivates.
<<back>> and <<return>>
<<back [linkText [passageName]]>>
Creates a link that undoes past moments in the story history (rolls the history back). With no arguments, shows a default label and undoes the most recent moment.
<<return [linkText [passageName]]>>
Creates a link that navigates forward to the previously visited passage (adds a new history moment). The distinction: <<back>> rolls back, <<return>> goes forward to a previous destination.
Form controls
All form-control macros modify a story variable via a quoted receiver name—e.g.,"$pie" rather than $pie—so the macro can write back to the variable.
<<checkbox "$var" uncheckedValue checkedValue [autocheck|checked]>>
Creates a checkbox that toggles the receiver variable between two values.
The quoted name of the variable to modify. Object/array property refs are supported:
"$foo.bar", "$foo[0]".Value set when the checkbox is unchecked.
Value set when the checkbox is checked.
Automatically pre-checks the checkbox based on the current value of the receiver variable.
Forces the checkbox to the checked state on render.
<<radiobutton "$var" checkedValue [autocheck|checked]>>
Creates a radio button. Multiple <<radiobutton>> macros sharing the same receiver variable form a group.
<<textbox "$var" defaultValue [passage] [autofocus]>>
Creates a single-line text input. Pressing Return/Enter may optionally forward to another passage.
<<textarea "$var" defaultValue [autofocus]>>
Creates a multi-line text input area.
<<numberbox "$var" defaultValue [passage] [autofocus]>>
Creates a number input. Accepts only numeric values and may optionally forward to a passage when Enter is pressed.
<<cycle "$var" [once] [autoselect]>> … <</cycle>>
Creates a cycling link that advances through a list of options on each click. Options are defined with <<option>> children or loaded from a collection with <<optionsfrom>>.
<<listbox "$var" [autoselect]>> … <</listbox>>
Creates an HTML <select> drop-down. Options are defined with <<option>> children or <<optionsfrom>>, same as <<cycle>>.