# Can we create Perspective Components through script?

**URL:** <https://forum.inductiveautomation.com/t/can-we-create-perspective-components-through-script/29047>\
**Category:** Ignition Early Access\
**Created:** [October 12, 2019, 10:20am UTC](https://forum.inductiveautomation.com/t/can-we-create-perspective-components-through-script/29047 "2019-10-12T10:20:49Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jianping.li](https://avatars.discourse-cdn.com/v4/letter/j/c89c15/32.png) [@jianping.li](https://forum.inductiveautomation.com/u/jianping.li)\
**Post date:** [October 12, 2019, 10:20am UTC](https://forum.inductiveautomation.com/t/can-we-create-perspective-components-through-script/29047/1 "2019-10-12T10:20:49Z")

</div>

I have a question about perspective script. Please see the image:

 ![dragfeature](https://us1.discourse-cdn.com/inductiveautomation/original/2X/6/67ad155d0c59ff264db3ac2da866869fd943fe4a.png)  
When I want to drag a time schedual to the time component(that is a flex container defineded by myself). I want to create a color block like the blue one in the image(when I drag a new schedual, the time component will show it’s time period , i think I need to create a label component in real time ). So a need a script method like create(‘Label’), and the define it’s label and background .  
Does ignition support create perspective components(like Label Icon and so on) through script?

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [October 14, 2019, 2:40pm UTC](https://forum.inductiveautomation.com/t/can-we-create-perspective-components-through-script/29047/2 "2019-10-14T14:40:56Z")

</div>

Short answer: No.

Long answer: Yes, but it’s fairly complicated, and only really works well in Flex Containers or as part of a Flex Repeater. What you need to do is place an Embedded View at the location. Now this Embedded View is neither a Label nor an Icon, so what you need to do is make a View which is ONLY a Label or ONLY an Icon.

To do this:  
Make a new View (I recommend using a Flex Container for the root).  
Select the View node in the Progress browser.  
Hold Shift and then right-click the View node, then select (Copy JSON).  
Paste the contents of your clipboard into a text editor.  
Change the `type` value to “ia.display.icon” or “ia.display.label”.  
If using the Icon, the `props` object should only have one key: `path`, and its value should be the path of the icon you want to use.  
If using the Label, the `props` object should only have a `text` key, and its value should be the text you want displayed.  
Now copy the contents of your text editor.  
Hold shift and right-click the View node, then select “Paste JSON”.  
The final step is to create a new param (`path` for icon, or `text` for Label), and bind the `path` or `text` to the param.

The following json is a Flex View which is an Icon. I can programmatically place this Icon anywhere in my project by setting the path of an Embedded View to use the path of this View, and supplying a `path` param which is the path of the Icon I want to use.

```auto
{
  "custom": {},
  "params": {
    "path": "material/camera"
  },
  "propConfig": {
    "params.path": {
      "paramDirection": "input",
      "persistent": true
    }
  },
  "props": {
    "defaultSize": {
      "height": 60,
      "width": 60
    }
  },
  "root": {
    "meta": {
      "name": "root"
    },
    "propConfig": {
      "props.path": {
        "binding": {
          "config": {
            "path": "view.params.path"
          },
          "type": "property"
        }
      }
    },
    "type": "ia.display.icon"
  }
}

```

You need to make sure that you account for whether or not the Embedded View should be displayed if you haven’t selected anything yet, and this is done via `EmbeddedView.position.display` (`false`) in Flex-type containers, or `EmbeddedView.props.style.display` (`none`) in other containers.
