# notifications

Instance to display notifications in Dashboard with custom levels

#### notification parameters:

| name        | type       | default | description                                                                                      |
| ----------- | ---------- | ------- | ------------------------------------------------------------------------------------------------ |
| message     | string     | ""      | Message of the notification                                                                      |
| level       | string     | "info"  | Level of the notification. Available: `success, error, warning, info`                            |
| autoDismiss | int        | 0       | Delay in seconds for the notification go away. `0` to not auto-dismiss the notification          |
| uuid        | int/string | null    | Notification won't be displayed without a uuid. Notifications with same uuid won't be displayed. |

## How to use

### **add**

```jsx
import { Plugin } from '@root'

Plugin.notifications.add({
    uuid: '503392020-32434-324234-434-34344',
    level: 'success',
    message: 'Your message'
})
```

![dashboard-dna-add-notification](https://camo.githubusercontent.com/1edb3f999326a7d71f11798ee572ed3d2228193d/68747470733a2f2f73332d65752d776573742d312e616d617a6f6e6177732e636f6d2f64617368626f6172642d67726170686963732f44617368626f6172642e6164644e6f74696669636174696f6e2e676966)

### **add confirm notifications**

You can send a confirm notification with add method

#### **Confirm item:**

```jsx
import { Plugin } from '@root'

const confirmPayload = {
    message: 'My confirm message',
    buttonTexts: ['Cancel', 'Confirm'],
    onConfirm: () => {},
    onCancel: () => {}
}

Plugin.notifications.add({
    uuid: '503392020-32434-324234-434-34344',
    level: 'success',
    confirm: confirmPayload
})
```

| name        | type     | default            | description                                                                                  |
| ----------- | -------- | ------------------ | -------------------------------------------------------------------------------------------- |
| message     | string   | null               | Message of the notification                                                                  |
| buttonTexts | array    | `['cancel', 'ok']` | Confirm buttons texts, first item take the cancel text and the second takes the confirm text |
| onConfirm   | function | null               | callback function will be called on confirm                                                  |
| onCancel    | function | null               | callback function will be called on cancel                                                   |

![dashboard-dna-confirm-notification](https://camo.githubusercontent.com/a90d6c97e83c248103ca11e4724d19d987d6771b/68747470733a2f2f73332d65752d776573742d312e616d617a6f6e6177732e636f6d2f64617368626f6172642d67726170686963732f44617368626f6172642e6164644e6f74696669636174696f6e2e436f6e6669726d2e676966)

### remove

By passing the same "notification" object that you want to remove, or by passing the uuid

```jsx
import { Plugin } from '@root'

Plugin.notifications.remove('503392020-32434-324234-434-34344')
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.navigaglobal.com/dashboard-plugin/api-and-gui/api/notifications.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
