tiny-engine ships its own JSX runtime — it has no dependency on React or any other UI framework. When the TypeScript compiler processes yourDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/sanchedev/tiny-engine/llms.txt
Use this file to discover all available pages before exploring further.
.tsx files it calls tiny-engine’s jsx factory function instead of React.createElement, turning every piece of JSX into a plain { type, props } descriptor that the engine renderer later converts into real Node instances.
Configuring tsconfig.json
Tell TypeScript to use tiny-engine’s runtime by setting jsxImportSource in your project’s tsconfig.json:
jsx, jsxs, and Fragment from tiny-engine/jsx-runtime — you never need to import them manually.
Intrinsic Elements
Intrinsic elements are the lowercase JSX tags that map directly to built-in engine node classes. The full set is typed viaJSX.IntrinsicElements, which is derived from PrimaryNode:
| JSX Tag | Engine Node |
|---|---|
<transform> | Transform |
<sprite> | Sprite |
<animation-player> | AnimationPlayer |
<collider> | Collider |
<ray-cast> | RayCast |
<clickable> | Clickable |
<timer> | Timer |
<rectangle> | Rectangle |
ref (a NodeReference<T> from useRefNode) and any event callback props exposed by that node type.
Function Components
Function components are plain TypeScript functions that receiveprops and return a Tiny.Node. This is the standard and recommended way to build reusable game objects in tiny-engine.
createGame — Bootstrapping from JSX
createGame from tiny-engine/jsx is the idiomatic way to wire up the entire game from a single JSX expression. It calls Game.setup, registers all <Scene> children with the SceneManager, loads the defaultScene, and starts the game loop. It returns a GameControls object so you can interact with the running game programmatically.
<List> — Reactive Keyed List Rendering
List is a built-in component (imported from tiny-engine/jsx) for rendering a dynamic, reactively updated list of nodes. It performs keyed reconciliation — nodes are reused, moved, or destroyed based on a key function rather than position, so identity is preserved across updates.
ListOptions Props
| Prop | Type | Required | Description |
|---|---|---|---|
array | T[] | SignalGetter<T[]> | ✅ | The data array, static or reactive |
itemKey | (value, index, arr) => string | symbol | ✅ | Unique key extractor for reconciliation |
children | (value, index, arr) => Tiny.Node | ✅ | Render function called for each item |
empty | Tiny.Node | — | Fallback rendered when the array is empty |
List returns a Fragment with a hidden anchor <transform> — no extra wrapper node is added to your scene graph.
Context API
tiny-engine providescreateContext and useContext for passing values down the component tree without explicit prop drilling. This is especially useful for sharing game-wide state (score, settings, player reference) across deeply nested components.
Fragment Support
Group multiple nodes without introducing a wrapper node using the<>…</> Fragment shorthand. Fragments are flattened into the parent’s children list by the renderer.