Widget support is deprecated and will be removed in a future release. See Deprecation Notice – Qlik Sense Widgets and Custom Components FAQ for more information.
This example describes how to create a new widget in the Widget editor and make it available in Qlik Sense.
Do the following:
Launch Dev Hub.
Click on the Widget editor button under Tools.
From the Welcome dialog, click Create new widget.
Fill in the details to identify your widget:
- Enter a name for the widget. This example uses the name Helloworld.
- A widget must belong to a widget library. Choose the example widget library that is installed with Qlik Sense. In this example, it is called qlik-widget-lib.
- You can designate a type for the widget, but it is not mandatory. For this example, from the Widget type drop-down list, select Other.
- If you wish, add a text description for the widget and an author.
If you intend to use a custom component in your widget, select the custom component from the list of available components. You can add a custom component dependency at a later stage, from the Settings dialog.
You can have more than one version of the same custom component in the Qlik Sense system and if more than one version exists, the dependency is defined for a specific version. The version defined as a dependency is the version that is used in the widget.Note: Widgets referencing a custom component that is not listed as a dependency will not render as expected.
Custom component dependencies for more details.
The Widget editor opens and the Helloworld widget is highlighted in the list of widgets in the open library.
At the top-right of the toolbar, select an app from the drop-down list.
This allows you to see a preview of the widget while you are creating it. If you were creating a widget that used data, the widget would use the data in the selected app to show the preview.
In the HTML editor, add the following HTML:
In the CSS editor, add the corresponding .color class:
You see the preview of the widget displaying Hello world! in blue, bold text and with font size 25 pixels.
In the toolbar, click Save.
Add the widget to a sheet in your app
When you have created a widget library and widgets, to be able to use them in your apps, you must export the library and import it into Qlik Sense as custom objects.
When the widget library is imported into Qlik Sense as a set of custom objects, you can add your newly-created widget to a sheet in any app you have access to.
Do the following:
In Qlik Sense, open an app and create a new sheet.
Go to the new sheet and click Edit.
From the assets panel, click the custom objects icon .
Find the library to which you added the Helloworld widget (this example used qlik-widget-lib).
Drag the Helloworld widget to the sheet.
Click Done in the toolbar.
When the widget is updated in the Widget editor, the changes will be reflected in your app.