Minimal custom widget for SAP Analytics Cloud, following the Custom Widget
Developer Guide structure:
a widget.json manifest plus a web-component JS file.
widget.json — manifest: name, properties (width, height, text), one
exposed scripting method (setText), and a reference to the hosted main.js.main.js — defines the <com-porticobenefits-helloworld> custom element
(a shadow-DOM <div> that renders the text property, default “Hello World”).icon.svg — small icon shown in the SAC widget panel.main.js and icon.svgThis repo is hosted at github.com/bboehm1986/sac-hello-world-widget and served via GitHub Pages at:
https://bboehm1986.github.io/sac-hello-world-widget/main.jshttps://bboehm1986.github.io/sac-hello-world-widget/icon.svgwidget.json already points at these URLs. GitHub Pages serves everything
over HTTPS with permissive CORS by default, so no extra config is needed for
SAC to fetch these files.
If GitHub Pages isn’t enabled yet for this repo: go to Settings > Pages,
under “Build and deployment” set Source: Deploy from a branch, branch
main, folder / (root), then Save. It takes a minute or two to go live
the first time — check the URL above returns the file (not a 404) before
registering the widget in SAC.
widget.json.text property to
confirm live property updates work.Widget_1.setText("...") from
a script to confirm the exposed method works.properties/events (e.g. an onClick event) once the basic
render loop is confirmed.<style> template to a build step (bundler) if
the widget grows.