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

# Text UI

Show a persistent key-hint tooltip anchored to the edge of the screen. Typically used inside `while` loops tied to a zone or proximity check.

***

## Show

```lua
exports['jiffy-ui']:ShowTextUI('Press E to open', {
    position = 'left-center',          -- anchor position (see below)
    type     = 'info',                 -- success | error | warning | info | primary
    icon     = 'fa-solid fa-door-open',

    -- Key chip badges (optional)
    keys = {
        { key = 'E', label = 'Open'  },
        { key = 'G', label = 'Leave' },
    },

    -- Shorthand for a single key chip:
    -- key = 'E',
})
```

**Positions:**

| Value           | Anchor                                   |
| --------------- | ---------------------------------------- |
| `left-center`   | Left edge, vertically centered (default) |
| `right-center`  | Right edge, vertically centered          |
| `top-center`    | Top edge, horizontally centered          |
| `bottom-center` | Bottom edge, horizontally centered       |

***

## Hide

```lua
exports['jiffy-ui']:HideTextUI()
```

***

## Typical usage pattern

```lua
local inside = false

CreateThread(function()
    while true do
        local ped    = PlayerPedId()
        local coords = GetEntityCoords(ped)
        local dist   = #(coords - vector3(100.0, 200.0, 30.0))

        if dist < 2.5 then
            if not inside then
                inside = true
                exports['jiffy-ui']:ShowTextUI('Press E to interact', {
                    key  = 'E',
                    icon = 'fa-solid fa-hand',
                })
            end

            if IsControlJustReleased(0, 38) then -- E key
                -- do the thing
            end

            Wait(0)
        else
            if inside then
                inside = false
                exports['jiffy-ui']:HideTextUI()
            end
            Wait(500)
        end
    end
end)
```

***

## Server relay

```lua
exports['jiffy-ui']:ShowTextUI(source, text, opts)
exports['jiffy-ui']:HideTextUI(source)
```
