# UI Bridges

Provides a unified API for handling DrawText UI and Notifications across multiple FiveM resources. Automatically routes to the appropriate underlying implementation based on what's active.

***

### Accessing the Module

```lua
local DRAWTEXT <const> = exports.boii_utils:get("modules.drawtext")
local NOTIFY <const> = exports.boii_utils:get("modules.notifications")
```

***

## Server

### drawtext.show(source, options)

Displays drawtext UI for a specific client.

#### Parameters

| Name      | Type     | Description                       |
| --------- | -------- | --------------------------------- |
| source    | `number` | Player server ID                  |
| options   | `table`  | Drawtext options                  |
| └ message | `string` | Text message to display           |
| └ icon    | `string` | Optional icon (depends on system) |

#### Example

```lua
DRAWTEXT.show(1, { message = "Hello, player!", icon = "info" })
```

***

### drawtext.hide(source)

Hides drawtext UI for a specific client.

#### Parameters

| Name   | Type     | Description      |
| ------ | -------- | ---------------- |
| source | `number` | Player server ID |

#### Example

```lua
DRAWTEXT.hide(1)
```

***

### notifications.send(source, options)

Sends a notification to a specific client.

#### Parameters

| Name       | Type     | Description                    |
| ---------- | -------- | ------------------------------ |
| source     | `number` | Player server ID               |
| options    | `table`  | Notification options           |
| └ type     | `string` | Notification type (e.g., info) |
| └ message  | `string` | Notification message           |
| └ duration | `number` | Duration in ms                 |

#### Example

```lua
NOTIFY.send(1, { type = "info", message = "You received $500", duration = 5000 })
```

***

## Client

### drawtext.show(options)

Displays drawtext UI locally on the client.

#### Parameters

| Name      | Type     | Description             |
| --------- | -------- | ----------------------- |
| options   | `table`  | Drawtext options        |
| └ message | `string` | Text message to display |
| └ icon    | `string` | Optional icon           |

#### Example

```lua
DRAWTEXT.show({ message = "Press E to interact", icon = "info" })
```

***

### drawtext.hide()

Hides the drawtext UI locally on the client.

#### Example

```lua
DRAWTEXT.hide()
```

***

### notifications.send(options)

Displays a notification on the client.

#### Parameters

| Name       | Type     | Description                       |
| ---------- | -------- | --------------------------------- |
| options    | `table`  | Notification options              |
| └ type     | `string` | Notification type (e.g., success) |
| └ message  | `string` | Notification message              |
| └ duration | `number` | Duration in ms                    |

#### Example

```lua
NOTIFY.send({ type = "success", message = "Mission Complete!", duration = 3000 })
```


---

# 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.boii.dev/old-docs/boii_utils/api/ui-bridges.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.
