# Inline notification

**Inline notifications** show up in the task flow to provide feedback or the status of an action. These notifications are task generated. They are persistent in nature and vanish after the issue is resolved by user.

## Usage

![Inline notification](<../images/inline-notification.png>)

### When to use

- Use inline notifications to show quick and precise feedback or status during the task flows.
- Use to notify status or feedback based on information, warning, success and danger.
- Usual places its usage are input fields like forms to show errors etc.

### Best practices

- Messaging should be context-based, short and concise.
- Do not overlap rest of the content.
- These are scrollable along with the other content on the screen.

### Formatting

The notification width varies based on the context and page layout. Their height is based on the content length, which should not exceed two lines of text. Some examples of layouts are form, right pane, banner etc.

![Inline notification formatting](<../images/inline-notification-formatting.png>)

## Design

![Inline notification specification](<../images/inline-notification-usage-construction.png>)

1. **Icon:** Informs users about the severity of a notification.
2. **Heading:** Gives users a quick overview of the notification (*optional*).
3. **Message:** Provides additional details of the notification.
4. **Action:** Area to take actions like canceling or resolving a notification (*optional*).

### Action button

![Inline notification actions](<../images/inline-notification-usage-actions.png>)

1. **No action:** Information only.
2. **Action:** Provides an action button.

### Notification types

![Inline notification variations](<../images/inline-notification-usage-variations.png>)

## Code

This component is used to bring attention of users to a result of some action. There are multiple options of what is the notification level: `information`, `success`, `caution`, `warning`, `danger` and `critical`.

### Usage

```
import { SiInlineNotificationComponent } from '@siemens/element-ng/inline-notification';

@Component({
  imports: [SiInlineNotificationComponent, ...]
})
```

#### Example

Component:

```typescript
/**
 * Copyright (c) Siemens 2016 - 2026
 * SPDX-License-Identifier: MIT
 */
import { Component } from '@angular/core';
import { SiInlineNotificationComponent } from '@siemens/element-ng/inline-notification';

@Component({
  selector: 'app-sample',
  imports: [SiInlineNotificationComponent],
  templateUrl: './si-inline-notification.html'
})
export class SampleComponent {}
```

Template:

```html
<si-inline-notification
  class="mb-6"
  severity="info"
  heading="Update Available"
  message="New software version 3.2.1 is now available for download."
  [action]="{ title: 'Read More', href: 'https://www.lipsum.com/', target: '_blank' }"
/>

<si-inline-notification
  class="mb-6"
  severity="success"
  heading="Upload"
  message="Your document has been uploaded to the cloud."
  [action]="{ title: 'Action' }"
/>

<si-inline-notification
  class="mb-6"
  severity="caution"
  heading="File operation"
  message="Deleting this folder will permanently remove all contained projects."
/>

<si-inline-notification
  class="mb-6"
  severity="warning"
  heading="Storage"
  message="Your storage space is running low. Please consider archiving old files."
  [action]="{ title: 'Action' }"
/>

<si-inline-notification
  class="mb-6"
  severity="danger"
  heading="Access"
  message="You do not have permission to access this resource."
  [action]="{ title: 'Action' }"
/>

<si-inline-notification
  class="mb-6"
  severity="critical"
  heading="Data Loss"
  message="Disk array failure detected. Contact support immediately."
/>

<si-inline-notification class="mb-6" severity="success" message="Message without a heading" />
```

### [SiInlineNotificationComponent](<https://github.com/siemens/element/blob/main/projects/element-ng/inline-notification/si-inline-notification.component.ts#L18-L55>)

**Kind:** component

**Selector:** `si-inline-notification`

```
import { SiInlineNotificationComponent } from '@siemens/element-ng/inline-notification';
```

```
component SiInlineNotificationComponent
```

#### Input Properties

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| [action](<https://github.com/siemens/element/blob/main/projects/element-ng/inline-notification/si-inline-notification.component.ts#L37-L37>) | `Link \| undefined` |  | Optional link action for inline notification events. |
| [embedded](<https://github.com/siemens/element/blob/main/projects/element-ng/inline-notification/si-inline-notification.component.ts#L54-L54>) | `boolean` | `false` | Displays in embedded style, w/o radius and indicator bar |
| [heading](<https://github.com/siemens/element/blob/main/projects/element-ng/inline-notification/si-inline-notification.component.ts#L27-L27>) | `TranslatableString \| undefined` |  | Heading of the message. |
| [message](<https://github.com/siemens/element/blob/main/projects/element-ng/inline-notification/si-inline-notification.component.ts#L32-L32>) (required) | `TranslatableString` |  | Main message of this inline notification. |
| [severity](<https://github.com/siemens/element/blob/main/projects/element-ng/inline-notification/si-inline-notification.component.ts#L22-L22>) (required) | `StatusType` |  | Status of inline notification. |
| [translationParams](<https://github.com/siemens/element/blob/main/projects/element-ng/inline-notification/si-inline-notification.component.ts#L47-L47>) | `{ [key: string]: any; } \| undefined` | `{}` | Params passed to the translation pipe |

### 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. |

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

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