replace Action

An action to replace components in the UI.

{
  "replace": {
    "ids": {
      "someID": {
        "type": "textarea",
        "text": "Text on the component"
      }
    }
  }
}

Properties

retainids
BOOL
Default: true

Retain the identifier of the outgoing view on the new view, unless the new view has an identifier set.

ids
OBJECT

A map of component ids to new replacement component JSON.

Note

On successful replace of components, the entire UI will be marked for re-layout.

Examples

Change a label to a text area

{
  "type": "view",
  "layout": "inline",
  "direction": "vertical",
  "components": [
    {
      "id": "exampleLabel",
      "type": "label",
      "text": "I am a text label to serve as the target"
    },
    {
      "type": "button",
      "text": "Modify the label",
      "events": [
        {
          "triggers": "actioned",
          "action": {
            "type": "json",
            "src": {
              "replace": {
                "ids": {
                  "exampleLabel": {
                    "type": "textarea",
                    "text": "My whole object type has changed, I am now a text area"
                  }
                }
              }
            }
          }
        }
      ]
    }
  ]
}