Skip to main content
Docktix

Build a widget

A widget is a web page, plus the files it needs, packed in a .zip. It talks to Docktix through the Widget SDK. You choose the name, permissions and places in the upload form.

Would you rather have an AI assistant build it? See Build a widget with AI.

Steps

  1. Make an entry page, for example index.html, that loads the SDK script.
  2. Call Docktix.init() once and wait for it before any other call.
  3. Build your widget with the calls in the SDK reference.
  4. Zip the files and check them against the rules below.
  5. Upload the zip in Settings > Widgets. See Add and manage widgets.
html
<!doctype html>
<html>
  <body>
    <div id="app">Loading...</div>
    <script src="https://sdk.docktix.com/sdk/v1/docktix-widget-sdk.js"></script>
    <script>
      Docktix.init()
        .then((context) => {
          document.getElementById('app').textContent = 'Hello ' + context.user.name;
        })
        .catch((error) => {
          document.getElementById('app').textContent = error.code + ': ' + error.message;
        });
    </script>
  </body>
</html>

A widget works only when Docktix opens it. Opening its page directly in a browser makes init fail.

Zip rules

Docktix checks these when you choose the zip and tells you what to fix.

RuleLimit
Zip size8 MB
Number of files200
Size of one file2 MB
Size once unpacked30 MB
File typeshtml, js, css, json, png, jpg, svg, woff2, map. Anything else is refused (for example .jpeg, .gif, .webp, .ico, .woff, .ttf, .txt).
File and folder namesLetters, digits and . _ - @ only. No spaces, no accented or non-English letters, no name that starts with a dot. Sub-folders are fine (for example assets/logo.svg). Names must differ by more than upper or lower case.
Entry pageAn .html file inside the zip. If you zipped a folder, the folder name is part of the path (my-widget/index.html). It should load the SDK script, or the widget cannot talk to Docktix (you get a warning).
Menu iconNot needed: Docktix shows its own icon for the left-menu tab.

A zip made on a Mac is fine: the extra __MACOSX folder and .DS_Store files are ignored. Any other hidden file makes the upload fail.

Good to know

  • Put index.html at the top of the zip, not inside a folder, and name the entry page when you upload.
  • A widget can have one left-menu tab and also one button per module, at the same time. Labels are up to 40 characters.
  • Pass modules to SDK calls by their API name: the module_api_name from Docktix.modules.list(). The module.api in the context and the ui.openRecord module use the same name.
  • Keep your widget's state in Docktix data. Do not rely on browser storage: it may be empty the next time the widget opens.
  • Each widget may make up to 10 calls per second. See Call limit and timeouts.
  • A popup widget can ask for its height with Docktix.ui.resize. A left-menu tab fills the page.
  • Read lists in pages of up to 100 records rather than one call per record.
  • Ask only for the permissions your widget needs. Administrators see them when they install it.