Autorun AI Docs

6. Component Management

These functions let you read and write component properties at runtime — loading states, toggling a form, swapping an icon.

They all live on context.component. The old flat names (context.updateComponentByName, …) do not exist.


context.component.getByName(name)

sync · returns object

Retrieves the component by its Component ID (the name you set in the settings panel).

Prop

Type

const form = context.component.getByName("formOffer");
console.log("Form is currently disabled:", form?.props?.disableForm);
Pro tip

console.log(context.component.getByName("myComponent")) in DevTools shows every prop the component currently has.


context.component.getPropByName(name, prop)

sync · returns any

Returns one prop without fetching the whole component.

const isDisabled = context.component.getPropByName("formOffer", "disableForm");

context.component.updateByName(name, prop, value)

sync · returns void

Updates a single prop. Changes take effect immediately.

Prop

Type

context.component.updateByName("btnEdit", "loading", true);

const disableForm = context.component.getPropByName("formOffer", "disableForm");

if (disableForm === false) {
  context.component.updateByName("formOffer", "disableForm", true);
  context.component.updateByName("formOffer", "hideButtons", true);
  context.component.updateByName("btnEdit", "icon", "CheckOutlined");
  context.toast.success("Edit mode off.");
} else {
  context.component.updateByName("formOffer", "disableForm", false);
  context.component.updateByName("formOffer", "hideButtons", false);
  context.component.updateByName("btnEdit", "icon", "LockOutlined");
  context.toast.success("Edit mode on.");
}

context.component.updateByName("btnEdit", "loading", false);

Setting loading: true on a button at the start of an async function and loading: false in a finally block is the standard pattern for visual feedback.


context.component.updateByKey(key, prop, value)

sync · returns void

Like updateByName, but targets the component's internal key rather than its Component ID.

context.component.updateByKey("comp_abc123", "visible", false);

context.component.updateState(name, prop, value)

sync · returns void

Updates a component's local state rather than its configuration props. Use this for transient UI state that should not be persisted.

context.component.updateState("panelFilters", "collapsed", true);