Switch Demo

A small room model where exported declarative actions update switches and grouped lights through useViewerActions.

Object Binding Circuit

Switch A

The exported binding object is passed to ModelViewer as state.

0/4 on
Switches
0/2 on
Lights
0/4 on
Switch A
Controls light_a_1 + light_a_2
Off
Switch B
Controls light_b_1 + light_b_2
Off

BindingBuilder creates the records. We add actions to the switch records, pass the bindings into the viewer, and patch the same bindings when an action runs.