Skip to main content
The widget global reads and controls widgets by their widget ID. (It’s singular — widget, not widgets.)

Values and text

widget.setValue(widgetId, value);          // set the widget's value
const v = widget.getValue(widgetId);       // read it
widget.setText(widgetId, text);            // set displayed text
const t = widget.getText(widgetId);        // read it

Visibility

widget.show(widgetId);
widget.hide(widgetId);

Position, size, rotation

widget.setPosition(widgetId, x, y);
widget.getPosition(widgetId);              // { x, y } | undefined
widget.setSize(widgetId, width, height);
widget.getSize(widgetId);                  // { width, height } | undefined
widget.resize(widgetId, width, height);
widget.move(widgetId, x, y);
widget.setRotation(widgetId, degrees);
widget.getRotation(widgetId);              // number | undefined

Config

widget.setConfig(widgetId, configKey, value);
widget.getConfig(widgetId, configKey);     // one key
widget.getConfig(widgetId);                // whole config object

The widget object

const w = widget.get(widgetId);            // DashboardWidget | undefined

Events

Subscribe to widget events. on and once return an unsubscribe function.
const off = widget.on(widgetId, 'change', (value) => { /* ... */ });
widget.once(widgetId, 'ready', () => { /* ... */ });
widget.off(widgetId, 'change');            // remove handlers for an event
widget.emit(widgetId, 'change', value);    // emit programmatically
off();                                      // unsubscribe
See Events for the full event vocabulary.

Events reference

Every event type a widget can fire.