Learn how Scrivito CMS can help you deliver amazing digital experiences
See Scrivito CMS in action

new Widget(attributes)

Creates a Widget instance.

The new widget must be stored inside a container (i.e. in an Obj or another Widget) before it can be used.

A widget can be stored inside a container by adding it to a widgetlist attribute using Obj#update or Widget#update.


  • attributes (Object) - The attributes of the new widget. The _objClass must be provided.


Creating a Page Obj object and a widget and placing the latter into the body widgetlist of the page.

page = Scrivito.getClass("Page").create({}); widget = new (Scrivito.getClass("TextWidget"))({text: 'Hello World'}); page.update({body: [widget]});