> For the complete documentation index, see [llms.txt](https://sbscripts.gitbook.io/sb-scripts/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://sbscripts.gitbook.io/sb-scripts/sb-text-ui/exports.md).

# Exports

### Client exports

#### `exports.sbtextui:Show(text, duration, key)`

Show the text UI. Calling `Show` while it is open replaces the text and restarts the timer.

| Parameter  | Type     | Description                                                                                                                                       |
| ---------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------- |
| `text`     | `string` | Text to display. Each `[KEY]` starts a new row with an orange key badge. Use `\n` for new lines.                                                  |
| `duration` | `number` | Time in milliseconds before it hides. `0` or `nil` keeps it open until `Hide` is called. Above `0`, an orange timer bar shows the remaining time. |
| `key`      | `string` | Optional. Shows a key badge, such as `'E'`. Omit it for text only.                                                                                |

```lua
exports.sbtextui:Show('Open VIP shop', 0, 'E')
exports.sbtextui:Show('[E] Open garage [G] Store vehicle')
```

#### `exports.sbtextui:Hide()`

Hide the text UI.

```lua
exports.sbtextui:Hide()
```

#### `exports.sbtextui:IsOpen()`

Returns `true` if the text UI is currently showing, otherwise `false`.

```lua
if exports.sbtextui:IsOpen() then
    exports.sbtextui:Hide()
end
```

### Server events

Use these from the server when your workflow already uses `TriggerClientEvent`.

```lua
TriggerClientEvent('sbtextui:show', src, text, duration, key)
TriggerClientEvent('sbtextui:hide', src)
```

| Event           | Parameters                       | Description                         |
| --------------- | -------------------------------- | ----------------------------------- |
| `sbtextui:show` | `src`, `text`, `duration`, `key` | Same as `Show`, sent to one player. |
| `sbtextui:hide` | `src`                            | Same as `Hide`, sent to one player. |

```lua
TriggerClientEvent('sbtextui:show', src, 'Open VIP shop', 0, 'E')
```
