> For the complete documentation index, see [llms.txt](https://docs.nm1scripts.in/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.nm1scripts.in/signature-series/nm1-notification/exports.md).

# Exports

This document describes **all available exports** provided by the `nm1_notification` resource, including **client-side** and **server-side** usage, parameters, defaults, and examples.

The system is **framework-agnostic** and works with ESX, QBCore, QBox, or standalone setups.

***

### Client Exports

#### `exports['nm1_notification']:Notify(data)`

Displays a notification **on the local client**.

This is the **primary and recommended client export** for showing notifications.

***

#### Parameters

`data` *(table)*

| Field      | Type   | Required | Default             | Description              |
| ---------- | ------ | -------- | ------------------- | ------------------------ |
| `title`    | string | No       | `"Notification"`    | Notification title       |
| `message`  | string | No       | `""`                | Notification body text   |
| `type`     | string | No       | `"info"`            | Notification type        |
| `duration` | number | No       | `5000`              | Duration in milliseconds |
| `position` | string | No       | Saved / `top-right` | Screen position          |
| `theme`    | string | No       | `"dark"`            | UI theme                 |

***

#### Supported Types

* `success`
* `error`
* `info`
* `warning`

***

#### Supported Positions

* `top`
* `top-right`
* `top-left`
* `bottom`
* `bottom-right`
* `bottom-left`
* `center-right`
* `center-left`

***

#### Example (Client)

```lua
exports['nm1_notification']:Notify({
    title = 'Success',
    message = 'Data saved successfully.',
    type = 'success',
    duration = 4000
})
```

***

#### Example (With Custom Position & Theme)

```lua
exports['nm1_notification']:Notify({
    title = 'Warning',
    message = 'Low fuel level.',
    type = 'warning',
    position = 'bottom-left',
    theme = 'light' -- or dark
})
```

***

### Server Exports

Server exports allow you to trigger notifications **from server-side code** to one or all players.

***

#### `exports['nm1_notification']:NotifyPlayer(src, data)`

Sends a notification to a **specific player**.

***

**Parameters**

| Field  | Type   | Required | Description                        |
| ------ | ------ | -------- | ---------------------------------- |
| `src`  | number | Yes      | Player server ID                   |
| `data` | table  | Yes      | Notification data (same as client) |

***

**Example (Server)**

```lua
exports['nm1_notification']:NotifyPlayer(source, {
    title = 'Server',
    message = 'You received a server notification.',
    type = 'info'
})
```

***

#### `exports['nm1_notification']:NotifyAll(data)`

Broadcasts a notification to **all connected players**.

***

**Parameters**

| Field  | Type  | Required | Description       |
| ------ | ----- | -------- | ----------------- |
| `data` | table | Yes      | Notification data |

***

**Example (Server)**

```lua
exports['nm1_notification']:NotifyAll({
    title = 'Announcement',
    message = 'Server restart in 5 minutes.',
    type = 'warning',
    duration = 6000
})
```

***

### Notes & Behavior

* All server exports internally trigger the client event\
  `nm1_notification:client:show`
* Saved notification position is persisted using **Resource KVP**
* Position is automatically applied:
  * On resource start
  * On player spawn
* If `position` is passed in `data`, it **overrides the saved position for that notification only**
* Theme defaults to `"dark"` if not provided

***

### Recommended Usage

| Scenario                | Recommended Export |
| ----------------------- | ------------------ |
| Client-only UI feedback | `Notify`           |
| Server → single player  | `NotifyPlayer`     |
| Server → all players    | `NotifyAll`        |

***


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.nm1scripts.in/signature-series/nm1-notification/exports.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
