All skills
secondsky avatar

/sap-sac-custom-widget

@4d87d99
by Eddiesecondsky/sap-skills456 stars
120

SAP Analytics Cloud (SAC) Custom Widget development. Use when building custom visualizations, extending SAC with Web Components, or creating Widget Add-Ons. Covers JSON metadata, JavaScript Web Components, lifecycle functions, data binding with feeds, styling/builder panels, property/event/method definitions, third-party library integration, hosting, security, performance, and debugging. Includes Widget Add-On feature (QRC Q4 2023+) and templates for widgets, charts, and KPI cards.

Use this Skill: https://skilld.dev/gh/secondsky/sap-skills/sap-sac-custom-widget

This session only. Nothing lands on disk.

referencescss-and-styling-compliance.md

≈1.9k tokens on demand. Your agent reads this file only when SKILL.md points to it.

SAC Custom Widget CSS and Styling Compliance

Official Sources:

Use this reference when generating or reviewing visual styling for SAC custom widgets. Treat it as SAC compatibility guidance for generated packages, not as a ban on expert hand-written CSS inside a Web Component.

Key Distinction

SAP documents both of these facts:

  • Custom widget resource files can include CSS, HTML, JavaScript, images, and related static files when they are hosted as custom-widget resources.
  • The custom widget restrictions list "Theme and CSS" as unsupported for custom widgets.

For generated widgets, interpret this as follows: style the widget inside its own Web Component boundary, but do not rely on SAC optimized story theme CSS, global story CSS classes, or SAP shell DOM selectors to style custom-widget internals.

Optimized story theme CSS is a separate SAC feature for story, page, popup, and standard-widget theming. It can conform to CSS standards, but generated custom widgets should remain self-contained and should not require story CSS to render correctly.

Allowed and Recommended

  • Put widget styling inside the Web Component template or another Shadow DOM-scoped mechanism.
  • Use :host for the custom element container and set stable SAC sizing defaults:
:host {
  display: block;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
}
  • Use responsive internal layout with width: 100%, height: 100%, min-height: 0, box-sizing: border-box, and overflow handling that does not hide critical data.
  • Use SAP theme custom properties with safe fallbacks where they preserve the intended design, for example var(--sapFontFamily, "72", Arial, sans-serif) and var(--sapTextColor, #1d2d3e).
  • Keep focus states visible, maintain readable contrast, and respect reduced-motion expectations for decorative animation.
  • Load brand images, icons, fonts, and chart libraries only from SAC-hosted files, local package assets, or deployment-approved HTTPS origins.
  • Use styling and builder panels as Web Components when users need design-time controls. Dispatch propertiesChanged from setters and keep visual state driven by manifest properties.
  • Let design-time panels inherit the SAC shell font. Reset font-family: inherit on panel form controls because browser controls may otherwise use their user-agent font.
  • Wait for document.fonts.ready and handle later font-loading cycles before caching measurements. Pair onCustomWidgetResize with a ResizeObserver on the widget box when visibility changes can bypass the SAC resize hook.

Restricted or Avoid

  • Do not depend on SAC story theme CSS to style the inside of a custom widget.
  • Do not target SAP shell, story canvas, or undocumented SAC internal class names from generated widget CSS.
  • Do not inject global styles into document.head to change SAC page or story behavior. Keep styles scoped to the widget.
  • Do not generate remote @import rules, remote font imports, or CSS url(http...) assets unless the user explicitly approves the host and the deployment can serve the resource to SAC browsers.
  • Do not reference assets that require authentication, authorization, session cookies, or tenant-local browser state. SAP documents custom-widget resource files as browser-requested static resources.
  • Do not add tracking pixels, analytics beacons, credentials, or user-specific URLs for visual polish.
  • Do not use fixed-only layouts that ignore SAC resize events or responsive story containers.
  • Do not hide labels, focus outlines, legends, or data values only to achieve a decorative look.
  • Decorative full-cover pseudo-elements must use pointer-events: none so they cannot block the control below them.

Hosting and Packaging Matrix

Hosting mode CSS and HTML guidance Generated package rule
External HTTPS/static server Custom widget resource files can include JavaScript, CSS, HTML, images, and similar static files if the browser can request them. External CSS/HTML resources are acceptable only when the host is approved, HTTPS, static, and accessible without session-only auth.
SAC-hosted resource files Host resource files in SAC when available for the tenant. Keep manifest URLs as browser URL paths and use / separators. Prefer self-contained JavaScript templates for generated packages unless the deployment owner confirms separate CSS/HTML hosting.
SAC ZIP resource upload SAP documents the ZIP as limited to Web Component JavaScript for main/styling/builder plus PNG/JPG icon; no subfolders; CSS and HTML files are not supported in the ZIP. Embed CSS inside the Web Component JavaScript template. Do not generate separate .css or .html files for ZIP upload packages.

webcomponents[].url should point to the Web Component JavaScript file for main, styling, or builder components. Do not point a webcomponent URL directly at .css or .html.

For responsive grids, test the smallest supported host frame. Use minmax(0, ...) tracks and cap long children so min-content sizing does not overflow. A layout variant must explicitly reset shared declarations such as align-items and justify-content when their meaning changes. Measure popup max-height against the host element, not a content-sized shell, and scroll inside the popup when the story frame is shorter than the content.

For close-on-blur popovers, keep focus while selecting non-focusable rows and require a meaningful relatedTarget before closing. DOM emulation cannot reproduce browser focus movement, so verify the real click and focus path in a browser.

Keep emitted data-* values and CSS selectors in one reviewable contract. When a new value is feature-gated, do not write its CSS variable for old configurations, and add a deliberate no-op rule when the base style is the intended result. This keeps default-off rendering stable and makes a missing selector visible in review.

LLM Generation Checklist

Before returning a generated custom widget package:

  • Confirm which hosting mode the user expects before splitting CSS into separate files.
  • Keep the widget functional without any SAC story theme CSS.
  • Keep all component CSS inside Shadow DOM or a clearly scoped Web Component style boundary.
  • Use :host and responsive container CSS so SAC story resizing does not break the layout.
  • Use SAP theme variables with fallbacks for text, background, focus, and semantic colors when compatible with the design.
  • Keep brand assets and external libraries local or on approved HTTPS origins.
  • If packaging for SAC ZIP upload, include only JavaScript component files and a PNG/JPG icon in the ZIP resource set.
  • Validate that manifest webcomponents[].url values reference JavaScript component files and that integrity settings match the deployment mode.

Source: SKILL.md on GitHub

1 alert16d5 checks · Risk SAFE
  • Gen Agent Trust Hub16d

    The skill provides a comprehensive environment and templates for developing SAP Analytics Cloud (SAC) Custom Widgets. It promotes robust security best practices, including subresource integrity (SRI), XSS prevention via input sanitization, and proper Shadow DOM encapsulation. It includes local tools for scaffold generation and iteration that operate on the user's machine without requiring external packages or services.

  • Socket16d

    No alerts

  • Snyk16d

    Risk: LOW · No issues

  • Runlayer6mo

    3/16 files flagged

  • ZeroLeaks5mo

    2 findings · Score: 80/100

Signed by skilld at 4d87d99. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 2 weeks ago.

Activeupdated last month
What it can do
Reads files Runs commands Network
All 3 allowed tools
ReadBashWebFetch
Other metadata
metadata
{
  "maintainer": "Eduard Jiglau",
  "maintainer_email": "hello@sap-ai-skills.com",
  "website": "https://sap-ai-skills.com",
  "version": "2.4.1",
  "last_verified": "2026-06-12",
  "sac_version": "2026.8",
  "errors_prevented": "40+",
  "official_docs": [
    "https://help.sap.com/docs/SAP_ANALYTICS_CLOUD/0ac8c6754ff84605a4372468d002f2bf/75311f67527c41638ceb89af9cd8af3e.html",
    "https://help.sap.com/doc/c813a28922b54e50bd2a307b099787dc/release/en-US/CustomWidgetDevGuide_en.pdf"
  ],
  "samples_repo": "https://github.com/SAP-samples/analytics-cloud-datasphere-community-content/tree/main/SAC_Custom_Widgets",
  "keywords": [
    "sap analytics cloud",
    "sac custom widget",
    "web component sac",
    "json metadata widget",
    "widget lifecycle functions",
    "onCustomWidgetBeforeUpdate",
    "onCustomWidgetAfterUpdate",
    "onCustomWidgetResize",
    "onCustomWidgetDestroy",
    "sac data binding",
    "dataBindings feeds",
    "styling panel widget",
    "builder panel widget",
    "sac echarts integration",
    "sac d3js integration",
    "third party library sac",
    "widget hosting sac",
    "integrity hash widget",
    "sha256 integrity",
    "widget security cors",
    "sac widget debugging",
    "sac analytics designer widget",
    "optimized story experience widget",
    "sac widget api",
    "widget add-on",
    "sac script api widget",
    "shadow dom web component",
    "sac tooltip customization",
    "plot area addon",
    "sac resource zip upload",
    "root relative widget url",
    "resource file upload",
    "builder focus collapse state",
    "self contained component js",
    "resource zip artifact naming",
    "chat download artifacts"
  ]
}

README badge

README badge for secondsky/sap-skills/sap-sac-custom-widget