Skip to main content

Interface: UiToggleEcsComponent

Defined in: ui/components/ui-toggle-component.ts:30

A rect that holds a persistent on/off state, flipped by invocation - the data half of a checkbox or radio button. Attach alongside a UiInteractableEcsComponent (for createUiToggleEcsSystem to read wasInvokedThisFrame from) and a RectTransformEcsComponent; use createToggle for the common "box with a checkmark" visual assembly, or build your own from these same pieces.

Extends​

Properties​

group?​

optional group?: number

Defined in: ui/components/ui-toggle-component.ts:19

The entity id of a UiToggleGroupEcsComponent this toggle belongs to. Toggles sharing a group are mutually exclusive - turning one on turns every other toggle in the group off (see createUiToggleEcsSystem). Omitted, this toggle behaves as an independent checkbox.

Inherited from​

UiToggleDefaultedOptions.group


isOn​

isOn: boolean

Defined in: ui/components/ui-toggle-component.ts:11

Whether this toggle is currently on. System-owned once group links it into a radio group's mutual exclusivity; freely settable otherwise.

Inherited from​

UiToggleDefaultedOptions.isOn


onValueChanged​

readonly onValueChanged: ParameterizedForgeEvent<boolean>

Defined in: ui/components/ui-toggle-component.ts:37

Raised whenever isOn changes - by a pointer click, a submit action, a group-driven mutual-exclusion flip, or a direct toggle.isOn = write followed by createUiToggleEcsSystem's next tick reconciling group state. Passes the new value.