Weather dashboard widget¶
Weather dashboard widget displays current weather conditions and, optionally, a short-term forecast for a single location.
Usage¶
The weather dashboard widget displays current temperature and sky conditions, with an optional short-term forecast and additional meteorological parameters like humidity or wind speed.
The widget supports different layouts, and both the forecast days and the number of additional meteological parameters can be configured according to the use case.

When to use¶
- In dashboards and tile layouts.
- To display current outdoor or environmental conditions.
- To offer users a quick overview of the day's or week's weather.
Best practices¶
- Show only the metrics most relevant to the context.
- Keep units consistent (e.g. °C or °F, km/h or mph).
- Pick the layout that matches the available tile size.
- Use a skeleton to represent the loading state.
Design¶
Elements¶

1. Heading (location), 2. Current temperature, 3. Illustration, 4. Condition label, 5. Min/Max range, 6. Additional metrics (optional), 7. Forecast (optional)
Layout variants¶
The widget supports three layouts:
- Vertical: Forecast with up to five columns of additional data (e.g., wind, precipitation, humidity, UV, pressure).
- Horizontal: Forecast with condition and temperature only.
- Compact: No forecast.
The forecast shows up to seven days. The number of days is configurable. Columns are hidden automatically as the widget narrows.

Icon style¶
Weather conditions can be represented with flat Element icons or illustrated icons. For illustrated icons, the style may vary depending on the weather provider.
![]()
Code¶
The weather widget is built around two Angular components: the widget itself, which wraps an <si-card>, and a body component that can be reused for compositions.
Component usage¶
To simplify the usage and reduce the code, Element offers an Angular component as a wrapper with streamlined inputs.
import { SiWeatherWidgetComponent } from '@siemens/element-ng/dashboard';
@Component({
:
imports: [SiWeatherWidgetComponent]
})
import { SiWeatherWidgetComponent } from '@siemens/element-ng/dashboard'; Dashboard widget for current weather conditions, additional metrics and an optional multi-day forecast.
The widget supports three layouts (see SiWeatherWidgetLayout):
• vertical (default): full vertical card with <si-card> heading, illustration, today block, optional additional data and an optional forecast table with up to five extra columns.
• horizontal: wider card with the today block laid out side by side and a horizontal forecast strip below. The forecast SHOULD contain at least three days for a visually balanced layout.
• compact: condensed variant without a card header. The location is rendered next to the illustration. The forecast is not shown.
Data is supplied as a composite value payload of type SiWeatherWidgetData.
Weather illustrations are resolved by an optional SiWeatherIconResolver that application developers register. Without a resolver the widget only renders illustrations when callers pass a direct illustration.src.
Input Properties¶
| Name | Type | Default | Description |
|---|---|---|---|
| accentLine ¶ | AccentLineType | undefined | Optional accent line. | |
| disableAutoLoadingIndicator ¶ | boolean | false | Option to disable automatic start of skeleton loading indication. |
| heading ¶ | TranslatableString | undefined | Card heading text. Used as the card header in | |
| imgAlt ¶ | TranslatableString | undefined | Alt text for a provided image. | |
| imgDir ¶ | "horizontal" | "vertical" | 'vertical' | Defines if an image is placed on top or start (left) of the card. |
| imgObjectFit ¶ | "fill" | "contain" | "cover" | "none" | "scale-down" | 'scale-down' | Sets the image object-fit CSS property. |
| imgObjectPosition ¶ | string | undefined | Sets the image object-position CSS property. | |
| imgSrc ¶ | string | undefined | Image source for the card. | |
| initialLoadingIndicatorDebounceTime ¶ | number | 300 | Initial delay time in milliseconds before enabling loading indicator. Only used once initially during construction. |
| layout ¶ | SiWeatherWidgetLayout | 'vertical' | Visual layout. SiWeatherWidgetLayout. |
| location ¶ | TranslatableString | undefined | Location displayed next to the illustration in the | |
| primaryActions ¶ | ContentActionBarMainItem[] | [] | Input list of primary action items. Supports up to 4 actions and omits additional ones. |
| secondaryActions ¶ | MenuItem[] | [] | Input list of secondary action items. |
| showLoadingIndicator ¶ | boolean | false | Input to start and stop the skeleton loading indication. |
| value ¶ | SiWeatherWidgetData | undefined | Composite weather payload of type SiWeatherWidgetData. |
Weather widget body component¶
The body of <si-weather-widget> is implemented in the component <si-weather-widget-body>. You can use it for compositions where the <si-card> wrapper is not appropriate.
import { SiWeatherWidgetBodyComponent } from '@siemens/element-ng/dashboard'; Body of the <si-weather-widget>. Useful for compositions that do not need the surrounding <si-card> chrome (e.g. embedding the weather inside a custom container).
Data is supplied as a composite value payload of type SiWeatherWidgetData.
The body delegates illustration resolution to the injected SiWeatherIconResolver. The library ships a default resolver that maps the built-in SiWeatherCondition vocabulary to Element icons.
In the vertical layout the forecast list responsively hides additional data columns (wind, humidity, …) via pure CSS container queries when the widget becomes too narrow. See si-weather-widget-body.component.scss for the thresholds.
Input Properties¶
| Name | Type | Default | Description |
|---|---|---|---|
| disableAutoLoadingIndicator inherited ¶ | boolean | false | Option to disable automatic start of skeleton loading indication. Inherited from |
| forecastLabel ¶ | TranslatableString | $localize`:@@SI_WEATHER_WIDGET.FORECAST_LABEL:Weather forecast` | Accessible label for the forecast section. |
| initialLoadingIndicatorDebounceTime inherited ¶ | number | 300 | Initial delay time in milliseconds before enabling loading indicator. Only used once initially during construction. Inherited from |
| layout ¶ | SiWeatherWidgetLayout | 'vertical' | Visual layout. SiWeatherWidgetLayout. |
| location ¶ | TranslatableString | undefined | Optional location label, shown inside the body in the compact layout only. The non-compact layouts render the location via the | |
| metricsLabel ¶ | TranslatableString | $localize`:@@SI_WEATHER_WIDGET.METRICS_LABEL:Additional weather data` | Accessible label for the additional data list. |
| showLoadingIndicator inherited ¶ | boolean | false | Input to start and stop the skeleton loading indication. Inherited from |
| value required inherited ¶ | SiWeatherWidgetData | undefined | The main value to be displayed. If no value is set, the skeleton indicates the loading of the value. Disable the automatic loading mechanism by setting Inherited from |
Attributes and Methods¶
| Name | Type | Default | Description |
|---|---|---|---|
| (readonly)showLoadingIndicator inherited ¶ | Signal<boolean> | ... | Inherited from |
Configurable playground¶
The configurable example exposes every input of the widget and is useful for exploring layouts, metrics and forecast extras interactively.
Icon resolver¶
Weather illustrations are produced by an injectable SiWeatherIconResolver. The library ships a default resolver that maps the built-in SiWeatherCondition vocabulary (clear, clouds, rain, storm, wind, unknown) to Element icons:
| Condition | Icon |
|---|---|
clear | element-sun |
clouds | element-cloudy |
rain | element-rain |
storm | element-storm |
wind | element-wind |
unknown | (no icon) |
Applications can override the default by providing their own resolver. A resolver returns either an Element icon name (rendered via <si-icon>) or a direct image URL (rendered as <img>); callers can also pass an src directly via illustration.src to bypass the resolver.
Implementing a custom resolver¶
A custom resolver extends SiWeatherIconResolver and returns one of:
{ icon: '<name>' }— rendered as<si-icon icon="…">.{ src: '<url>' }— rendered as<img src="…">.null— no illustration is shown.
The example below uses the MIT-licensed meteocons static SVG set (@meteocons/svg-static). The icons are exposed via angular.json under /assets/meteocons/:
// angular.json (assets array)
{
"glob": "*.svg",
"input": "node_modules/@meteocons/svg-static/fill",
"output": "/assets/meteocons/"
}
The resolver is a small class that maps the six built-in condition tokens to file names. For more complex scenarios, you can introduce or reuse a richer condition vocabulary. It is registered as a component-level provider, so the override is scoped to this example:
providers: [{ provide: SiWeatherIconResolver, useClass: SiWeatherWidgetMeteoconsIconResolver }];
For an application-wide override, register the resolver in the root injector instead (providedIn: 'root' on the class itself, or via providers in bootstrapApplication).
import { SiWeatherIconResolver } from '@siemens/element-ng/dashboard'; Maps a semantic SiWeatherIcon to a renderable illustration. The library ships a SiDefaultWeatherIconResolver that maps the built-in SiWeatherCondition vocabulary to Element icons, so the widget renders a reasonable illustration out of the box. Applications can override the mapping or add provider-specific vocabularies by registering their own resolver:
Example:
@Injectable({ providedIn: 'root' })
export class MyWeatherIconResolver extends SiWeatherIconResolver {
override resolve(icon: SiWeatherIcon): SiWeatherIconResolution | null {
// ...
}
}
Resolvers SHOULD return null for unknown or 'unknown' conditions so the widget can skip the illustration.
Attributes and Methods¶
| Name | Type | Description |
|---|---|---|
| resolve() ¶ | (icon: SiWeatherIcon) => SiWeatherIconResolution | null | Parameters |
Types Documentation¶
ContentActionBarMainItem
( MenuItemAction | MenuItemCheckbox | MenuItemLink | MenuItemRouterLink | MenuItemGroup ) & { iconOnly?: boolean } ¶
Composite payload accepted by the body component. Granular widget/body inputs ( metrics ? : current, metrics, forecast) take precedence when set.
readonly SiWeatherWidgetMetric[] ¶
Visual layout of the SiWeatherWidgetComponent. • • • vertical: full vertical card layout with header, today block, optional additional data and an optional vertical forecast table.horizontal: wider card with the today block laid out side by side and a horizontal forecast strip below.compact: condensed card without a card header. Location and min/max temperature are rendered next to the illustration. Does not show a forecast.
Represents a translatable string. This can either be a translation key, e.g. ACTIONS.EDIT that will be automatically translated when displayed on the UI or a pre-translated string, e.g. Edit. Equivalent to a normal string in usage and functionality.
Describes how a weather illustration should be resolved. Callers can either provide a direct SiWeatherIcon.src or a semantic SiWeatherIcon.condition token resolved by a SiWeatherIconResolver.
Result returned by a SiWeatherIconResolver. Implementations should return either icon (rendered via <si-icon>) or src (rendered as a plain <img>). When both are present, icon wins.
Today block of the weather widget. Translatable condition label, e.g. Weather illustration. A string is shorthand for illustration ? : Optional alt text used when illustration is given as a string. Today's maximum temperature, pre-formatted by the caller. maxTemperature ? : Today's minimum temperature, pre-formatted by the caller. minTemperature ? : Current temperature, pre-formatted by the caller (e.g. temperature :
"Sunny".{ src }.string | SiWeatherIcon ¶ string | number ¶ string | number ¶ "26°" or 26).string | number ¶
Forecast block of the weather widget. The vertical layout supports up to five optional columns in addition to the mandatory rightmost min/max temperature column. The horizontal layout ignores columns and renders only day label, illustration and min/max temperature per column. A horizontal forecast should provide at least three days for a visually balanced layout. Optional extra columns (vertical layout only). At most five are rendered. columns ? : The forecast days in display order. days :
readonly SiWeatherWidgetForecastColumn[] ¶ readonly SiWeatherWidgetForecastDay[] ¶
Action that called when the item is triggered. A function will be called, a string will be dispatched to the SiMenuActionService. action : Badge that is rendered after the label. badge ? : Color of the badge (not iconBadge). badgeColor ? : Whether the menu item id disabled. disabled ? : Optional icon that will be rendered before the label. icon ? : Badge (always red) that is attached to the icon. If value===true, an empty red dot will be rendered. iconBadge ? : ID that will be attached to the DOM node. id ? : Label that is shown to the user. label :
string | ((actionParam: any, source: MenuItemAction) => void) ¶ string | number Inherited from MenuItemBase ¶ string Inherited from MenuItemBase ¶ boolean Inherited from MenuItemBase ¶ string Inherited from MenuItemBase ¶ string | number | boolean Inherited from MenuItemBase ¶ string Inherited from MenuItemBase ¶ TranslatableString Inherited from MenuItemBase ¶
Action that called when the item is triggered. A function will be called, a string will be dispatched to the SiMenuActionService. action : Badge that is rendered after the label. badge ? : Color of the badge (not iconBadge). badgeColor ? : Whether the checkbox is checked. Whether the menu item id disabled. disabled ? : Optional icon that will be rendered before the label. icon ? : Badge (always red) that is attached to the icon. If value===true, an empty red dot will be rendered. iconBadge ? : ID that will be attached to the DOM node. id ? : Label that is shown to the user. label :
string | ((actionParam: any, source: MenuItemCheckbox) => void) ¶ string | number Inherited from MenuItemBase ¶ string Inherited from MenuItemBase ¶ boolean Inherited from MenuItemBase ¶ string Inherited from MenuItemBase ¶ string | number | boolean Inherited from MenuItemBase ¶ string Inherited from MenuItemBase ¶ TranslatableString Inherited from MenuItemBase ¶
Badge that is rendered after the label. badge ? : Color of the badge (not iconBadge). badgeColor ? : Whether the menu item id disabled. disabled ? : The href property of the anchor. Optional icon that will be rendered before the label. icon ? : Badge (always red) that is attached to the icon. If value===true, an empty red dot will be rendered. iconBadge ? : ID that will be attached to the DOM node. id ? : Label that is shown to the user. label : The target property of the anchor.
string | number Inherited from MenuItemBase ¶ string Inherited from MenuItemBase ¶ boolean Inherited from MenuItemBase ¶ string Inherited from MenuItemBase ¶ string | number | boolean Inherited from MenuItemBase ¶ string Inherited from MenuItemBase ¶ TranslatableString Inherited from MenuItemBase ¶
Represents a menu item that navigates using the Angular Router. Requires a configured Angular Router. Badge that is rendered after the label. badge ? : Color of the badge (not iconBadge). badgeColor ? : Whether the menu item id disabled. disabled ? : Navigation extras that are passed to the RouterLink. extras ? : Optional icon that will be rendered before the label. icon ? : Badge (always red) that is attached to the icon. If value===true, an empty red dot will be rendered. iconBadge ? : ID that will be attached to the DOM node. id ? : Label that is shown to the user. label : Link for the angular router. Accepts the same values as RouterLink. routerLink :
string | number Inherited from MenuItemBase ¶ string Inherited from MenuItemBase ¶ boolean Inherited from MenuItemBase ¶ NavigationExtras ¶ string Inherited from MenuItemBase ¶ string | number | boolean Inherited from MenuItemBase ¶ string Inherited from MenuItemBase ¶ TranslatableString Inherited from MenuItemBase ¶ string | any[] ¶
Badge that is rendered after the label. badge ? : Color of the badge (not iconBadge). badgeColor ? : Submenu items for this menu item. Whether the menu item id disabled. disabled ? : Optional icon that will be rendered before the label. icon ? : Badge (always red) that is attached to the icon. If value===true, an empty red dot will be rendered. iconBadge ? : ID that will be attached to the DOM node. id ? : Label that is shown to the user. label :
string | number Inherited from MenuItemBase ¶ string Inherited from MenuItemBase ¶ boolean Inherited from MenuItemBase ¶ string Inherited from MenuItemBase ¶ string | number | boolean Inherited from MenuItemBase ¶ string Inherited from MenuItemBase ¶ TranslatableString Inherited from MenuItemBase ¶
Items that are part of the radio group. children :
[MenuItemHeader, ...(MenuItemRadio | MenuItemHeader | MenuDivider)[]] ¶
Action that called when the item is triggered. A function will be called, a string will be dispatched to the SiMenuActionService. action : Badge that is rendered after the label. badge ? : Color of the badge (not iconBadge). badgeColor ? : Whether the radio is checked. Whether the menu item id disabled. disabled ? : Optional icon that will be rendered before the label. icon ? : Badge (always red) that is attached to the icon. If value===true, an empty red dot will be rendered. iconBadge ? : ID that will be attached to the DOM node. id ? : Label that is shown to the user. label :
string | ((actionParam: any, source: MenuItemRadio) => void) ¶ string | number Inherited from MenuItemBase ¶ string Inherited from MenuItemBase ¶ boolean Inherited from MenuItemBase ¶ string Inherited from MenuItemBase ¶ string | number | boolean Inherited from MenuItemBase ¶ string Inherited from MenuItemBase ¶ TranslatableString Inherited from MenuItemBase ¶
A single day in the forecast block. Weather illustration for the day. A string is shorthand for illustration ? : Translatable day label, e.g. Maximum temperature, pre-formatted by the caller. maxTemperature : Minimum temperature, pre-formatted by the caller. minTemperature :
{ src }.string | SiWeatherIcon ¶ "Mon".string | number ¶ string | number ¶
An optional forecast column shown left of the temperature column in vertical layouts. The widget supports up to five of these columns; additional columns are ignored. The temperature column is mandatory and always rendered on the right; it does not need to be modelled as a column here. element-icons icon name shown next to each row value. Translatable column label, used as label ? : Per-day values, aligned by index with SiWeatherWidgetForecast.days. Missing entries are rendered as empty cells.
aria-label for the column.TranslatableString ¶
Badge that is rendered after the label. Color of the badge (not iconBadge). badgeColor ? : Whether the menu item id disabled. Optional icon that will be rendered before the label. Badge (always red) that is attached to the icon. If value===true, an empty red dot will be rendered. ID that will be attached to the DOM node. Label that is shown to the user.
string ¶
Except where otherwise noted, content on this site is licensed under MIT License.