Skip to content

CheckboxInput

A checkbox. The inspector renders a standard checkbox control.

Runtime value: { type: "checkbox"; value: boolean } — read .value

CheckboxInput inspector control

Declaration

Declare with a type: "checkbox" envelope and an initial value:

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

export default class Demo extends Behaviour {
  data = {
    visible:    { type: "checkbox", value: true }  as CheckboxInput,
    castShadow: { type: "checkbox", value: false } as CheckboxInput,
  };
}

Runtime usage

Read the .value property:

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

Notes

  • Use CheckboxInput for property-style options (e.g. "Cast shadow", "Visible") and ToggleInput for simple on/off feature flags.
  • ToggleInput is a plain boolean and requires no envelope — use it when you don't need the checkbox visual.