← Docs index Embed Web Component: cosmos-sector-widget moonshot-dashboard-kit v0.0.8 • built 2026-10-29T14:29:10.704Z

Embed Web Component: cosmos-sector-widget

Responsive web component for displaying lifetime diversion results for one business sector. It looks the same as moonshot-sector-results, without the View link, and reads its data from the Cosmos API (DASHBOARD_COSMOS_API_V1_BASE_URL).

Install

Include the component library in the head of your HTML:

<script src="lib/moonshot-cosmos-sector-widget.js"></script>

How to Use

Provide exactly one sector_alias:

<cosmos-sector-widget
  sector_alias="hospitals">
</cosmos-sector-widget>

By default, the component displays lifetime waste diverted, impact equivalencies, and four count cards for customers, cities, locations, and containers.

Counts include every non-cancelled location in the sector. Paused and suspended locations still count. Cities is the number of distinct city values of those locations.

When creating the component with JavaScript, set the properties before connecting the element:

const sectorWidget = document.createElement('cosmos-sector-widget')
sectorWidget.sectorAlias = 'hospitals'
document.body.appendChild(sectorWidget)

Configuration Attributes

Option Description
sector_alias Required. A single business-sector URL alias.
showCounts Whether to show the four count cards. Default is true.
autoRefresh Optional refresh frequency in seconds. Omit or set to 0 to disable.
borderColor Overrides card and divider borders. Light-theme default is #D8D8D8.
fontColor Overrides headings, labels, and supporting text. Light-theme default is #3B3B3B.
theme Display theme. Supported values are light and dark; default is light.
debug Set to true to output non-sensitive debug information to the console.

city_alias is not supported; results always cover the whole sector.

Hide Count Cards

Set showCounts to false to render only the primary waste-diverted card:

<cosmos-sector-widget
  sector_alias="hospitals"
  showCounts="false">
</cosmos-sector-widget>

Responsiveness

The component fills the available embed width without imposing a minimum width and is capped at 1024px. It centers itself when more width is available.

Responsive behavior is based on the component's own rendered width: