Create your first widget

Create your first widget

Before creating a widget, you need to have the Command Line Interface installed. Learn more

Click here to know about the limitations while creating a widget.

To create a widget:

  1. Open the terminal.
  2. Run the following command to create a new project:
    $ zet init
  3. A list of Zoho Services will be displayed.
  4. Select Zoho Creator as the required service.

  5. Enter the Project Name. The sample project will be created in the respective folder directory.
  6. Run the following command to open the project folder.
    $ cd {Project_name}

  7. Open the app folder in your project folder. Find the Widget.html file in the folder.

  8. Enter your code in the Widget.html file. The widget.html file contains the structure, design and components of the Widget. To use the Zoho Creator APIs in the widget, you can use the API helpers provided in the JS SDK Library.

  9. Run the following command to validate your application:
    $ zet validate
  10. This will validate your app package and identify any violations. They should be corrected before updating the zip in the developer console.
  11. Run the following command to pack the project.
    $ zet pack

  12. A zip file of the application will be created in the dist folder of your project directory.

  13. Navigate to the Settings page of the app in which you need to embed your widget. Select Widgets.
  14. Click Create button.

  15. The New Widget pane will appear.

  16. Enter a name for your Widget.
  17. Choose Internal option in the Hosting drop down list.
  18. Upload the packed zip file from the dist folder in the Widget File field.
  19. Enter /widget.html in the Index File field.

  20. Click Create. The created widget is added to the Widgets page.
  21. This widget will appear as a drag-and-drop element in Page builder for all the Pages present in the application.

External Hosting

The procedure given above pertains to the internal hosting of widgets (i.e.) the widgets are hosted within Creator. Alternatively the widgets can also be hosted externally and linked up with Creator.

The procedure for external hosting of widgets is as follows:

  1. Go to the Application Settings page. Then click on Widgets option.
  2. Now click on the New Widget button in the Widgets page. The New Widget pane will appear.

  3. Enter a name for your Widget.
  4. Choose External option in the Hosting drop down list.
  5. Enter the Index page URL of the externally hosted widget in the Index File field.

  6. Click Create. The created widget is added to the Widgets page.
  7. This widget will appear as a drag-and-drop element in Page builder for all the Pages present in the application.

Related Topics

Share this post : FacebookTwitter

Still can't find what you're looking for?

Write to us: support@zohocreator.com