Documentation 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.
Clickable turns a rectangular region of the screen into an interactive hit area. Every frame it checks whether the pointer is inside a rectangle anchored at its world-space position with dimensions given by size. It fires mouseEntered on the first frame the pointer enters, mouseExited when it leaves, and clicked when a press-and-release cycle finishes inside the area.
There is no default size — you must always pass size. Disable the node temporarily with disabled without removing it from the scene.
Clickable extends Node2D, so it inherits position, id, zIndex, deltaIncrease, ref, script, and children.
Usage
Props
Dimensions of the hit rectangle in pixels. There is no default — this prop is always required. Accepts
Vector2, {x, y}, [x, y], or a single number for a square area. Reactive when a SignalGetter is passed.When
true, all pointer event checking is suspended. Events will not fire and the debug overlay turns grey. Reactive when a SignalGetter is passed. Defaults to false.Shorthand callback for the
clicked event. Equivalent to useEvent(ref, 'clicked', fn). The position argument is the local coordinate relative to the node’s top-left corner.Shorthand callback for the
mouseEntered event. Fires once on the frame the pointer enters the hit area.Shorthand callback for the
mouseExited event. Fires once on the frame the pointer leaves the hit area.Local position offset. The hit rectangle starts at this position;
size extends it to the right and down.A ref created by
useRefNode(PrimaryNode.Clickable). Exposes the Clickable instance for runtime inspection.Optional child nodes rendered inside this clickable area.
Events
Subscribe withuseEvent.
| Event name | Callback signature | Description |
|---|---|---|
clicked | (position: Vector2) => void | Fires when a pointer press-and-release completes inside the area. position is local (relative to node’s top-left). |
mouseEntered | () => void | Fires once on the first frame the pointer enters the hit area. |
mouseExited | () => void | Fires once on the first frame the pointer leaves the hit area. |
mouseOver | (position: Vector2) => void | Fires every frame the pointer is inside the area. position is local. |
started | () => void | Fires once after the node finishes start(). |
updated | (delta: number) => void | Fires every frame during the update cycle. |
drawed | (delta: number) => void | Fires every frame during the draw cycle. |
destroyed | () => void | Fires once when the node is removed. |
Debug visualisation
SettestOptions.showClickables = true to draw hit rectangles at runtime. Active areas render in yellow; disabled areas render in grey.
Example — hover highlight with useSignal
Example — conditionally disabled button
size has no default value. Omitting it is a runtime error. If your button dimensions change over time, pass a SignalGetter instead of patching the node directly.Related
Transform— position the clickable in world spaceSprite— the visual element typically paired with a clickableuseSignal— reactive hover or disabled stateuseComputed— derive brightness or color from hover stateuseEvent— subscribe toclicked,mouseEntered,mouseExited