# Summary widget

**Summary widgets** are more detailed than summary chips and can include an optional icon (representing a category or state), a value, and a label. These components are versatile and can be used to display various types of information, from summarizing data to visualizing current states or conditions.

## Usage

Summary widgets can be either selectable or read-only. They may include an icon to visually represent the state or category of the displayed value. Additionally, labels can be added to provide extra context or clarification.

**Example: Overview of categories:**

![Summary widget category](<../images/summary-widget-categories.png>)

**Example: Overview of states:**

![Summary widget states](<../images/summary-widget-states.png>)

- **Visual state representation**: Incorporate icons in summary widgets to visually represent the state or category of the displayed value.
- **Detailed summary**: Use summary widgets to provide more detailed summaries, including labels and additional context.
- **Readonly information**: Present detailed read-only information with clear labels and values.

### When to use

Use container component to organize a number of summary widgets or other elements such as buttons, links, and badges. The container can have a background of None, background-0, or background-1.

![Summary widget example](<../images/summary-widget-example.png>)

## Design

### Elements

![Summary widget construction](<../images/summary-widget-usage-construction.png>)

> 1. Category icon or composite icon (optional), 2. Value, 3. Label

- **Icon**: The summary widget can hold an icon or a composite icon representing a state.
- **Value**: The primary numerical or textual value being summarized.
- **Label**: A short text label providing context or description of the value.

Here an idea of icons representing states:

![Summary widget icon states](<../images/summary-widget-usage-icon-states.png>)

### States

![Summary widget states](<../images/summary-widget-usage-states.png>)

## Code

#### Example

Component:

```typescript
/**
 * Copyright (c) Siemens 2016 - 2026
 * SPDX-License-Identifier: MIT
 */
import { NgTemplateOutlet } from '@angular/common';
import { Component } from '@angular/core';
import { SiSummaryWidgetComponent } from '@siemens/element-ng/summary-widget';

@Component({
  selector: 'app-sample',
  imports: [NgTemplateOutlet, SiSummaryWidgetComponent],
  templateUrl: './si-summary-widget.html'
})
export class SampleComponent {}
```

Template:

```html
<div class="d-flex gap-4 p-5 background-0">
  <ng-container [ngTemplateOutlet]="widgets" />
</div>
<div class="d-flex gap-4 p-5 background-1">
  <ng-container [ngTemplateOutlet]="widgets" />
</div>

<ng-template #widgets>
  <si-summary-widget
    icon="element-connected"
    color="status-success"
    label="OCCP"
    value="Connected"
  />
  <si-summary-widget
    icon="element-checked"
    color="status-success"
    label="Connector DC"
    value="Available"
  />
  <si-summary-widget
    icon="element-in-use"
    color="status-danger"
    label="Connector AC"
    value="Occupied"
  />
  <si-summary-widget
    icon="element-code-working"
    color="text-secondary"
    label="Firmware"
    value="v4.0.8.0-ga65b633"
    readonly
  />
  <si-summary-widget icon="element-break" color="status-warning" label="Beverage" value="Coffee" />
  <si-summary-widget
    icon="element-wind"
    color="status-danger"
    label="Weather"
    value="Windy"
    disabled
  />
  <si-summary-widget label="Label" value="Value" />
</ng-template>
```

### [SiSummaryWidgetComponent](<https://github.com/siemens/element/blob/main/projects/element-ng/summary-widget/si-summary-widget.component.ts#L16-L66>)

**Kind:** component

**Selector:** `si-summary-widget`

```
import { SiSummaryWidgetComponent } from '@siemens/element-ng/summary-widget';
```

```
component SiSummaryWidgetComponent
```

#### Input Properties

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| [color](<https://github.com/siemens/element/blob/main/projects/element-ng/summary-widget/si-summary-widget.component.ts#L22-L22>) | `string \| undefined` |  | Color class, see [https://element.siemens.io/fundamentals/typography/\#color-variants-classes](<https://element.siemens.io/fundamentals/typography/#color-variants-classes>). |
| [disabled](<https://github.com/siemens/element/blob/main/projects/element-ng/summary-widget/si-summary-widget.component.ts#L45-L45>) | `boolean` | `false` | Disabled state. |
| [icon](<https://github.com/siemens/element/blob/main/projects/element-ng/summary-widget/si-summary-widget.component.ts#L20-L20>) | `string \| undefined` |  | Icon token, see [https://element.siemens.io/icons/element](<https://element.siemens.io/icons/element>). |
| [label](<https://github.com/siemens/element/blob/main/projects/element-ng/summary-widget/si-summary-widget.component.ts#L28-L28>) (required) | `TranslatableString` |  | The label. |
| [readonly](<https://github.com/siemens/element/blob/main/projects/element-ng/summary-widget/si-summary-widget.component.ts#L40-L40>) | `boolean` | `false` | Readonly state. |
| [selected](<https://github.com/siemens/element/blob/main/projects/element-ng/summary-widget/si-summary-widget.component.ts#L35-L35>) | `boolean` | `false` | Selected state, will change when clicked. |
| [stackedColor](<https://github.com/siemens/element/blob/main/projects/element-ng/summary-widget/si-summary-widget.component.ts#L26-L26>) | `string \| undefined` |  | Color class, see [https://element.siemens.io/fundamentals/icons/](<https://element.siemens.io/fundamentals/icons/>). |
| [stackedIcon](<https://github.com/siemens/element/blob/main/projects/element-ng/summary-widget/si-summary-widget.component.ts#L24-L24>) | `string \| undefined` |  | Icon token, see [https://element.siemens.io/fundamentals/icons/](<https://element.siemens.io/fundamentals/icons/>). |
| [status](<https://github.com/siemens/element/blob/main/projects/element-ng/summary-widget/si-summary-widget.component.ts#L18-L18>) | `ExtendedStatusType \| undefined` |  | Status. Alternatively, use [icon](<index.html#SiSummaryWidgetComponent.icon>) and [color](<index.html#SiSummaryWidgetComponent.color>). |
| [value](<https://github.com/siemens/element/blob/main/projects/element-ng/summary-widget/si-summary-widget.component.ts#L30-L30>) (required) | `TranslatableString` |  | Value to display. |

#### Output Properties

| Name | Type | Description |
| --- | --- | --- |
| [selectedChange](<https://github.com/siemens/element/blob/main/projects/element-ng/summary-widget/si-summary-widget.component.ts#L35-L35>) | `boolean` | Selected state, will change when clicked. |

### Types Documentation

### [ExtendedStatusType](<https://github.com/siemens/element/blob/main/projects/element-ng/common/models/status-type.model.ts#L8-L8>)

**Kind:** type alias

```
import type { ExtendedStatusType } from '@siemens/element-ng/common';
```

```
type ExtendedStatusType = StatusType | 'unknown'
```

### [TranslatableString](<https://github.com/siemens/element/blob/main/projects/element-translate-ng/translate-types/global.types.ts#L18-L18>)

**Kind:** type alias

```
import type { TranslatableString } from '@siemens/element-translate-ng/translate-types';
```

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.

```
type TranslatableString = string & Translatable
```

### [StatusType](<https://github.com/siemens/element/blob/main/projects/element-ng/common/models/status-type.model.ts#L7-L7>)

**Kind:** type alias

```
import type { StatusType } from '@siemens/element-ng/common';
```

```
type StatusType = 'success' | 'info' | 'warning' | 'danger' | 'caution' | 'critical'
```
