# Link dashboard widget

**Link dashboard widget** is a list of [links](<https://element.siemens.io/components/buttons-menus/links/>) that provides quick access to frequently used functions, pages, or external resources.

## Usage

![Link dashboard widget](<../images/link-dashboard-widget.png>)

### When to use

- In dashboards and [tile layouts](<https://element.siemens.io/fundamentals/layouts/content/#tile-layout>).
- To provide a list of navigation or action links.

### Best practices

- Prevent overcrowding by keeping the number of links between 2 and 6.
- Keep labels short and clear, directly indicating the link's purpose and destination.
- Arrange links by their relevance or frequency of use to facilitate quick access.
- Use [skeleton](<https://element.siemens.io/components/progress-indication/skeleton/>) to represent its loading state.

## Design

### Elements

![Link dashboard widget elements](<../images/link-dashboard-widget-elements.png>)

> 1. Icon (optional), 2. Heading, 3. Actions (optional), 4. Links

## Code

The link widget is implemented by CSS classes and the usage of other Element components.

### Component usage

To simplify the usage and reduce the code, Element offers a Angular component as wrapper with streamlined inputs. The component should be used together with the [card](<https://element.siemens.io/components/layout-navigation/cards/>).

```
import { SiLinkWidgetComponent } from '@siemens/element-ng/dashboard';

@Component({
  :
  imports: [SiLinkWidgetComponent]
})
```

#### Example

Component:

```typescript
/**
 * Copyright (c) Siemens 2016 - 2026
 * SPDX-License-Identifier: MIT
 */
import { ChangeDetectorRef, Component, inject, OnInit } from '@angular/core';
import { SiCardComponent } from '@siemens/element-ng/card';
import { ContentActionBarMainItem } from '@siemens/element-ng/content-action-bar';
import { SiLinkWidgetComponent } from '@siemens/element-ng/dashboard';
import { SiIconComponent } from '@siemens/element-ng/icon';
import { Link } from '@siemens/element-ng/link';
import { MenuItem } from '@siemens/element-ng/menu';
import { LOG_EVENT } from '@siemens/live-preview';

@Component({
  selector: 'app-sample',
  imports: [SiCardComponent, SiIconComponent, SiLinkWidgetComponent],
  templateUrl: './si-link-widget.html',
  styles: `
    .card-size {
      height: 400px;
    }
  `,
  host: { class: 'p-5' }
})
export class SampleComponent implements OnInit {
  logEvent = inject(LOG_EVENT);
  private cdRef = inject(ChangeDetectorRef);

  primaryActions: ContentActionBarMainItem[] = [
    { type: 'action', label: 'Settings', action: () => this.logEvent('Settings clicked') },
    { type: 'action', label: 'Copy', action: () => this.logEvent('Copy clicked') },
    { type: 'action', label: 'Delete', action: () => this.logEvent('Delete clicked') }
  ];

  secondaryActions: MenuItem[] = [
    { type: 'action', label: 'Settings', action: () => this.logEvent('Settings clicked') },
    { type: 'action', label: 'Copy', action: () => this.logEvent('Copy clicked') }
  ];

  links?: Link[];

  ngOnInit(): void {
    setTimeout(() => {
      this.links = [
        { title: 'Card link', href: 'https://element.siemens.io' },
        { title: 'Card link', href: 'https://element.siemens.io' },
        { title: 'Card link', href: 'https://element.siemens.io' },
        { title: 'Print action', action: () => this.logEvent('Print job started.') }
      ];
      this.cdRef.markForCheck();
    }, 2000);
  }
}
```

Template:

```html
<div class="row">
  <div class="col-6 mb-6">
    <si-card
      class="h-100"
      heading="Heading"
      [primaryActions]="primaryActions"
      [secondaryActions]="secondaryActions"
    >
      <si-icon headerIcon class="icon me-3" icon="element-checked" />
      <si-link-widget class="card-body" body showLinkIcons [numberOfLinks]="4" [value]="links" />
    </si-card>
  </div>
  <div class="col-6 mb-6">
    <si-card
      class="h-100"
      heading="Heading"
      [primaryActions]="primaryActions"
      [secondaryActions]="secondaryActions"
    >
      <si-link-widget class="card-body" body showLinkIcons [numberOfLinks]="4" [value]="links" />
    </si-card>
  </div>
  <div class="col-6 mb-6">
    <si-card class="h-100" heading="Heading">
      <si-icon headerIcon class="icon me-3" icon="element-checked" />
      <si-link-widget class="card-body" body showLinkIcons [numberOfLinks]="4" [value]="links" />
    </si-card>
  </div>
  <div class="col-6 mb-6">
    <si-card class="h-100" heading="Heading">
      <si-link-widget class="card-body" body showLinkIcons [numberOfLinks]="4" [value]="links" />
    </si-card>
  </div>
</div>
```

### [SiLinkWidgetComponent](<https://github.com/siemens/element/blob/main/projects/element-ng/dashboard/widgets/si-link-widget/si-link-widget.component.ts#L30-L47>)

**Kind:** component

**Selector:** `si-link-widget`

```
import { SiLinkWidgetComponent } from '@siemens/element-ng/dashboard';
```

The `<si-link-widget>` supports an easy composition of links and actions with support for skeleton loading indicator.

```
component SiLinkWidgetComponent extends SiWidgetBaseDirective<Link[]>
```

#### Input Properties

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| [disableAutoLoadingIndicator](<https://github.com/siemens/element/blob/main/projects/element-ng/dashboard/widgets/si-widget-base.directive.ts#L35-L35>) (inherited) | `boolean` | `false` | Option to disable automatic start of skeleton loading indication.<br><br>Inherited from `SiWidgetBaseDirective<Link[]>` |
| [initialLoadingIndicatorDebounceTime](<https://github.com/siemens/element/blob/main/projects/element-ng/dashboard/widgets/si-widget-base.directive.ts#L59-L59>) (inherited) | `number` | `300` | Initial delay time in milliseconds before enabling loading indicator. Only used once initially during construction.<br><br>Inherited from `SiWidgetBaseDirective<Link[]>` |
| [numberOfLinks](<https://github.com/siemens/element/blob/main/projects/element-ng/dashboard/widgets/si-link-widget/si-link-widget.component.ts#L42-L42>) | `number` | `3` | The number of skeleton progress indication rows. |
| [showLinkIcons](<https://github.com/siemens/element/blob/main/projects/element-ng/dashboard/widgets/si-link-widget/si-link-widget.component.ts#L36-L36>) | `boolean` | `false` | Option to enable trailing link arrow icons for each link. |
| [showLoadingIndicator](<https://github.com/siemens/element/blob/main/projects/element-ng/dashboard/widgets/si-widget-base.directive.ts#L41-L45>) (inherited) | `boolean` | `false` | Input to start and stop the skeleton loading indication.<br><br>Inherited from `SiWidgetBaseDirective<Link[]>` |
| [value](<https://github.com/siemens/element/blob/main/projects/element-ng/dashboard/widgets/si-widget-base.directive.ts#L29-L29>) (required, inherited) | `Link[] \| 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 `SiWidgetBodyBaseComponent.disableAutoLoadingIndicator`.<br><br>Inherited from `SiWidgetBaseDirective<Link[]>` |

#### Attributes and Methods

##### showLoadingIndicator

[Source for showLoadingIndicator](<https://github.com/siemens/element/blob/main/projects/element-ng/dashboard/widgets/si-widget-base.directive.ts#L49-L51>)

**Modifiers:** readonly, inherited

**Type:** `Signal<boolean>`

**Default:** `...`

Inherited from `SiWidgetBaseDirective<Link[]>`

### CSS class usage

For more flexibility and control, use the CSS classes directly in the `<si-card>` component.

#### Example

Component:

```typescript
/**
 * Copyright (c) Siemens 2016 - 2026
 * SPDX-License-Identifier: MIT
 */
import { Component, inject } from '@angular/core';
import { SiCardComponent } from '@siemens/element-ng/card';
import { ContentActionBarMainItem } from '@siemens/element-ng/content-action-bar';
import { SiIconComponent } from '@siemens/element-ng/icon';
import { Link, SiLinkDirective } from '@siemens/element-ng/link';
import { MenuItem } from '@siemens/element-ng/menu';
import { LOG_EVENT } from '@siemens/live-preview';

@Component({
  selector: 'app-sample',
  imports: [SiLinkDirective, SiIconComponent, SiCardComponent],
  templateUrl: './si-link-widget-css.html',
  styles: `
    .card-size {
      height: 400px;
    }
  `,
  host: { class: 'p-5' }
})
export class SampleComponent {
  logEvent = inject(LOG_EVENT);

  elementLink: Link = {
    href: 'https://element.siemens.io',
    tooltip: 'APP.CLAIM'
  };

  primaryActions: ContentActionBarMainItem[] = [
    { type: 'action', label: 'Settings', action: () => this.logEvent('Settings clicked') },
    { type: 'action', label: 'Copy', action: () => this.logEvent('Copy clicked') },
    { type: 'action', label: 'Delete', action: () => this.logEvent('Delete clicked') }
  ];

  secondaryActions: MenuItem[] = [
    { type: 'action', label: 'Settings', action: () => this.logEvent('Settings clicked') },
    { type: 'action', label: 'Copy', action: () => this.logEvent('Copy clicked') }
  ];
}
```

Template:

```html
<div class="row">
  <div class="col-6 mb-6">
    <si-card
      class="h-100"
      heading="Heading"
      [primaryActions]="primaryActions"
      [secondaryActions]="secondaryActions"
    >
      <si-icon headerIcon class="icon me-3" icon="element-checked" />
      <div class="card-body si-link-widget" body>
        <a [siLink]="elementLink">
          Card link
          <i aria-hidden="true" class="link-icon link-end element-right-2 flip-rtl"></i>
        </a>
        <a [siLink]="elementLink">
          Card link
          <i aria-hidden="true" class="link-icon link-end element-right-2 flip-rtl"></i>
        </a>
        <a href="https://element.siemens.io">
          Card link
          <i aria-hidden="true" class="link-icon link-end element-right-2 flip-rtl"></i>
        </a>
        <button type="button" class="btn btn-link" (click)="logEvent('Print job started.')">
          Print action
        </button>
      </div>
    </si-card>
  </div>

  <div class="col-6 mb-6">
    <si-card
      class="h-100"
      heading="Heading"
      [primaryActions]="primaryActions"
      [secondaryActions]="secondaryActions"
    >
      <div class="card-body si-link-widget" body>
        <a [siLink]="elementLink">
          Card link
          <i aria-hidden="true" class="link-icon link-end element-right-2 flip-rtl"></i>
        </a>
        <a [siLink]="elementLink">
          Card link
          <i aria-hidden="true" class="link-icon link-end element-right-2 flip-rtl"></i>
        </a>
        <a href="https://element.siemens.io">
          Card link
          <i aria-hidden="true" class="link-icon link-end element-right-2 flip-rtl"></i>
        </a>
        <button type="button" class="btn btn-link" (click)="logEvent('Print job started.')">
          Print action
        </button>
      </div>
    </si-card>
  </div>

  <div class="col-6 mb-6">
    <si-card class="h-100" heading="Heading">
      <si-icon headerIcon class="icon me-3" icon="element-checked" />
      <div class="card-body si-link-widget" body>
        <a [siLink]="elementLink">
          Card link
          <i aria-hidden="true" class="link-icon link-end element-right-2 flip-rtl"></i>
        </a>
        <a [siLink]="elementLink">
          Card link
          <i aria-hidden="true" class="link-icon link-end element-right-2 flip-rtl"></i>
        </a>
        <a href="https://element.siemens.io">
          Card link
          <i aria-hidden="true" class="link-icon link-end element-right-2 flip-rtl"></i>
        </a>
        <button type="button" class="btn btn-link" (click)="logEvent('Print job started.')">
          Print action
        </button>
      </div>
    </si-card>
  </div>

  <div class="col-6 mb-6">
    <si-card class="h-100" heading="Heading">
      <div class="card-body si-link-widget" body>
        <div class="si-link-widget-skeleton"></div>
        <div class="si-link-widget-skeleton"></div>
        <div class="si-link-widget-skeleton"></div>
        <div class="si-link-widget-skeleton"></div>
      </div>
    </si-card>
  </div>
</div>
```

### Types Documentation

### [Link](<https://github.com/siemens/element/blob/main/projects/element-ng/link/link.model.ts#L8-L51>)

**Kind:** interface

```
import type { Link } from '@siemens/element-ng/link';
```

```
interface Link
```

#### Properties

| Name | Type | Description |
| --- | --- | --- |
| [action](<https://github.com/siemens/element/blob/main/projects/element-ng/link/link.model.ts#L42-L42>) (optional) | `string \| ((param?: any) => void \| any)` | A function that will be invoked when clicking on the menu item. When passed as a string, use together with SiLinkActionService to receive events. This is meant for repetitive things in lists/tables/etc. |
| [disabled](<https://github.com/siemens/element/blob/main/projects/element-ng/link/link.model.ts#L50-L50>) (optional) | `boolean` | A boolean that lets the link know whether it is disabled or not. |
| [href](<https://github.com/siemens/element/blob/main/projects/element-ng/link/link.model.ts#L22-L22>) (optional) | `string` | Defines a href URI that the menu item will be linked to. Will be used to set the href attribute of the a element. Will only be used if link and function is not set. |
| [isActive](<https://github.com/siemens/element/blob/main/projects/element-ng/link/link.model.ts#L46-L46>) (optional) | `boolean` | A boolean that lets the link know whether it is active or not. It is useful when action() is executed instead of link route. |
| [link](<https://github.com/siemens/element/blob/main/projects/element-ng/link/link.model.ts#L32-L32>) (optional) | `string \| any[]` | Defines the link of the menu item within the application using the angular router link concept. Accepts an array of `any` as per \[routerLink API definition\][https://angular.dev/api/router/RouterLink](<https://angular.dev/api/router/RouterLink>). |
| [navigationExtras](<https://github.com/siemens/element/blob/main/projects/element-ng/link/link.model.ts#L36-L36>) (optional) | `NavigationExtras` | The navigation extras provide additional routing options when using the router link. |
| [target](<https://github.com/siemens/element/blob/main/projects/element-ng/link/link.model.ts#L27-L27>) (optional) | `string` | The target attribute specifies where to open the linked document. If no target is specified, the link will open in the current tab. |
| [title](<https://github.com/siemens/element/blob/main/projects/element-ng/link/link.model.ts#L12-L12>) (optional) | `TranslatableString` | The title of the menu item. Can be either the title to be displayed or the translation key. |
| [tooltip](<https://github.com/siemens/element/blob/main/projects/element-ng/link/link.model.ts#L17-L17>) (optional) | `TranslatableString` | The optional tooltip of the link. Can be either the text to be displayed or the translation key. |

### [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
```
