Create the widget structure

Widgets are added to an extension’s structure in a/widget directory that is at the same level as the extension’s ext.json file.

When you create a new widget, it is important to ensure that the name is less than 50 characters. An error will occur if the name contains more than 50 characters.

Each widget should have its own child directory in the /widget directory. The following example shows the directories and files that can be included for a widget:

<extension-name> : the root folder of your extension     
            ext.json 
            widget/         
               <widget-type>/
                 widget.json             
                 templates/
                   display.template             
                 js/
                   <widget-type>.js             
                 less
                   widget.less             
                 locales/
                   <locale code, for example, en or en_US>/
                        ns.<widget-type>.json
                   <other locale codes>/
                        ns.<widget-type>.json
                 images/

If your widget does not involve the creation of user interface elements or require custom JavaScript, the widget structure can omit a number of directories and files used for these purposes. The following shows the minimum set of files and directories needed for a widget to pass validation on upload:

<extension-name>
     ext.json
     widget/
          <widget-type>/
             widget.json