insert Action

An action to insert new components into the UI.

{
  "insert": {
    "ids": {
      "someID": [
        {
          "type": "label",
          "text": "I am a new label"
        }
      ]
    }
  }
}

Properties

ids
OBJECT

A map of parent view ids containing ARRAY of JSON component objects to add to the given parent id.

Specified components will be appended to the end of the component array.

Note

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

Examples

Add a label

{
  "id": "mainView",
  "type": "view",
  "layout": "inline",
  "direction": "vertical",
  "components": [
    {
      "type": "button",
      "text": "Add a label",
      "events": [
        {
          "triggers": "actioned",
          "action": {
            "type": "json",
            "src": {
              "insert": {
                "ids": {
                  "mainView": [
                    {
                      "type": "label",
                      "text": "I am a new label"
                    }
                  ]
                }
              }
            }
          }
        }
      ]
    }
  ]
}