Skip to content

ToggleInput

An on/off toggle switch. The inspector renders a pill-shaped toggle.

Runtime value: boolean

ToggleInput inspector control

Declaration

ts
import { Behaviour, type ToggleInput } from "@relu-interactives/spatial-ecs";

export default class Demo extends Behaviour {
  data = {
    enabled:   true as ToggleInput,
    loopAudio: false as ToggleInput,
  };
}

Runtime usage

Use the value directly as a boolean:

ts
onUpdate() {
  if (!this.data.enabled) return;
  // ... rest of update logic
}

Notes

  • Prefer ToggleInput for feature flags (e.g. "Enabled", "Loop") and CheckboxInput for property-style options.
  • Both types resolve to a plain boolean at runtime.