Tea reserves certain passage names, tag names, and variable names for its own use. Getting these right is critical — they must be spelled and capitalized exactly as shown, and mixing special passages with code tags on the same passage will produce unpredictable behavior.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.
Code passages
Code passages are used only as code or UI infrastructure — they should never be navigated to directly. They run at specific points in the passage lifecycle or populate parts of the UI bar.PassageDone
PassageDone
Runs after each passage is rendered and displayed. Use it for post-display tasks such as applying dynamic DOM changes. Generates no output.Roughly equivalent to the
:passagedisplay navigation event.PassageFooter
PassageFooter
PassageHeader
PassageHeader
Prepended to each rendered passage. Use it to inject header content into every passage automatically.Roughly equivalent to the
:passagestart navigation event.PassageReady
PassageReady
Runs before each passage is rendered. Use it for pre-display tasks such as applying dynamic changes before the player sees the passage. Generates no output.Roughly equivalent to the
:passagestart navigation event.StoryAuthor
StoryAuthor
StoryBanner
StoryBanner
StoryCaption
StoryCaption
Populates the story’s caption area in the UI bar (element ID:
story-caption). Often used to add additional story-specific UI elements and content to the sidebar.StoryDisplayTitle
StoryDisplayTitle
Sets the title shown in the browser’s titlebar and the UI bar (element ID:
story-title). If omitted, the story title is used instead. Introduced in v2.31.0.StoryInit
StoryInit
Runs once at the very beginning of story initialization, before the starting passage is displayed. Use it for variable initialization and one-time setup tasks. Generates no output.
StoryInterface
StoryInterface
Replaces Tea’s default UI entirely. Its contents are treated as raw HTML — none of Tea’s special HTML processing is performed. The markup is wrapped in
<div id="story" role="main"> and must contain at least one element with id="passages" as the main passage display area.Additional elements may use data-init-passage (populated once at init) or data-passage (updated on each navigation) to bind passage content.StoryMenu
StoryMenu
StorySettings
StorySettings
StorySubtitle
StorySubtitle
Sets the story’s subtitle in the UI bar (element ID:
story-subtitle).StoryTitle
StoryTitle
- Twine 2: Not a code passage. The title is part of the story project itself.
- Twine 1/Twee: Required. Sets the story’s title.
Special passages
These passages receive special treatment from the engine itself.Start
- Twine 2: Not a special passage. Any passage may be set as the starting passage using the Start Story Here context menu item in the editor.
- Twine 1/Twee: Required. The first passage displayed when the story starts. Configurable via
Config.passages.start.
Code tags
Passages tagged with these tags are treated as code or data and cannot be navigated to.init
init
Registers the passage as an initialization passage. It runs at the beginning of story initialization — the same timing as
StoryInit — and generates no output.This tag is primarily intended for add-ons and libraries. For ordinary story projects, use the
StoryInit special passage (combined with <<include>> if you need additional structure). Introduced in v2.36.0.script
script
- Twine 2: Unused. Add JavaScript via the Edit Story JavaScript menu item instead.
- Twine 1/Twee: Registers the passage as JavaScript code that is executed during startup.
stylesheet
stylesheet
- Twine 2: Unused. Add CSS via the Edit Story Stylesheet menu item instead.
- Twine 1/Twee: Registers the passage as a CSS stylesheet loaded during startup.
Twine.audio
Twine.audio
Registers the passage as an audio media passage. See the Media Passages guide for details. Introduced in v2.24.0.
Twine.image
Twine.image
Registers the passage as an image media passage. See the Media Passages guide for details.
Twine.video
Twine.video
Registers the passage as a video media passage. See the Media Passages guide for details. Introduced in v2.24.0.
Twine.vtt
Twine.vtt
Registers the passage as a VTT (Video Text Track) media passage. See the Media Passages guide for details. Introduced in v2.24.0.
widget
widget
Registers the passage as containing
<<widget>> macro definitions. Widget passages are loaded during startup and their definitions are available everywhere in the story.Special tags
nobr
Causes leading and trailing newlines to be removed from the passage, and all remaining sequences of newlines to be replaced with single spaces, before the passage is rendered. This is equivalent to wrapping the entire passage in a <<nobr>> macro.
Apply nobr to individual passages that need compact whitespace handling. To apply the same behavior to every passage in your story at once, use Config.passages.nobr.
The
nobr tag does not affect script or stylesheet tagged passages in Twine 1/Twee.Special variables
These are global variables provided by Tea and the browser. Do not redefine them.API objects
| Variable | Description |
|---|---|
Config | Configuration API — controls story behavior and engine settings |
Dialog | Dialog API — opens and manages modal dialogs |
Engine | Engine API — controls playback, navigation, and history |
Fullscreen | Fullscreen API — manages browser fullscreen mode (v2.31.0+) |
LoadScreen | LoadScreen API — controls the loading screen (v2.15.0+) |
Macro | Macro API — defines and manages custom macros |
Passage | Passage API — provides information about passages |
Save | Save API — manages saves, auto-saves, and disk exports |
Setting | Setting API — defines player-configurable settings |
SimpleAudio | SimpleAudio API — manages audio tracks, groups, and playlists (v2.28.0+) |
State | State API — provides access to the story state and history |
Story | Story API — provides access to story metadata and passages |
Template | Template API — registers and manages template markup (v2.29.0+) |
UI | UI API — manages the built-in dialogs and UI interactions |
UIBar | UIBar API — controls the sidebar UI bar (v2.17.0+) |
Utility variables
| Variable | Description |
|---|---|
$ | Alias for jQuery. Not to be confused with story variables, which also start with $ — e.g., $foo. |
jQuery | jQuery library function, available globally. |
l10nStrings | Strings localization object. Override its properties to translate the built-in UI text. Introduced in v2.10.0. |
settings | Player settings object, populated by the Setting API with the values the player has chosen. |
setup | Object for storing non-persistent static data — values that do not change and should not enter the story history or be stored in saves. |
Widget-only variables
These variables are only defined inside<<widget>> macro definitions.
| Variable | Description |
|---|---|
_args | Array of arguments passed to the widget. Introduced in v2.36.0. |
_contents | String containing the rendered inner content of a block widget. Introduced in v2.36.0. |