> ## Documentation Index
> Fetch the complete documentation index at: https://fxscripts.dev/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Client exports

> Client-side exports for fxChat — control the chat UI, query state, react to events.

Run from the client. Useful for reacting to chat UI state — pausing a
minigame while chat is open, hiding chat during cutscenes, etc.

## `isOpen()`

Check whether the chat is currently open.

```lua Client theme={null}
local open = exports.fxChat:isOpen()
```

<ParamField path="returns" type="boolean">
  `true` if the chat input is visible and focused.
</ParamField>

```lua Example — pause while typing theme={null}
CreateThread(function()
    while true do
        if exports.fxChat:isOpen() then
            -- skip your minigame frame logic
        end
        Wait(0)
    end
end)
```

***

## `setVisible(visible)`

Force-show or hide the chat without opening it for input.

```lua Client theme={null}
exports.fxChat:setVisible(visible)
```

<ParamField path="visible" type="boolean" required>
  `true` to show the chat overlay, `false` to hide it.
</ParamField>

<Tip>
  Useful for cinematic moments — hide chat during cutscenes, restore on
  exit.
</Tip>

```lua Example — hide during cutscene theme={null}
exports.fxChat:setVisible(false)
DoScreenFadeOut(500)
-- ... cutscene logic ...
DoScreenFadeIn(500)
exports.fxChat:setVisible(true)
```

***

## `focus(open)`

Open or close the chat input programmatically.

```lua Client theme={null}
exports.fxChat:focus(open)
```

<ParamField path="open" type="boolean" required>
  `true` to open and focus the input, `false` to close.
</ParamField>

```lua Example — bind a custom key theme={null}
RegisterCommand('+chatopen', function()
    exports.fxChat:focus(true)
end, false)

RegisterKeyMapping('+chatopen', 'Open chat', 'keyboard', 'Y')
```

***

## `addLocalMessage(options)`

Render a message **only** for the current player, without bouncing through
the server. Great for client-side feedback.

```lua Client theme={null}
exports.fxChat:addLocalMessage(options)
```

`options` accepts the same fields as the server-side
[`addMessage`](/docs/fxchat/exports/server#addmessage-target-options) (minus
`target`).

```lua Example — pickup feedback theme={null}
RegisterNetEvent('myresource:itemPicked', function(itemName)
    exports.fxChat:addLocalMessage({
        args = ('You picked up a %s.'):format(itemName),
        title = 'Inventory',
        color = '#10b981',
    })
end)
```

<Note>
  `addLocalMessage` is **not** broadcast. Only this client sees it. If you
  need other players to see the message too, use the server-side
  [`addMessage`](/docs/fxchat/exports/server#addmessage-target-options).
</Note>

***

## `getActiveTheme()`

Returns the name of the theme currently applied to this client.

```lua Client theme={null}
local themeName = exports.fxChat:getActiveTheme()
```

<ParamField path="returns" type="string">
  e.g. `"default"`, `"midnight"`, `"ghostty"`. Matches a JSON file in
  `themes/`.
</ParamField>

***

## `setActiveTheme(name)`

Switch the chat theme for this client.

```lua Client theme={null}
exports.fxChat:setActiveTheme(name)
```

<ParamField path="name" type="string" required>
  The theme filename without `.json` (e.g. `"midnight"`).
</ParamField>

```lua Example — themed by job theme={null}
local PlayerData = ESX.GetPlayerData()
if PlayerData.job.name == 'police' then
    exports.fxChat:setActiveTheme('crimson')
end
```
