Prompt Options
Last updated on
Each call to show takes a group table. Each item in prompts is a PromptEntry.
Prompt group
| Property | Type | Default | Description |
|---|---|---|---|
id | string | required | Group id. show('id', data) also sets this |
position | string | table | config.defaultPosition | Named slot or custom { x, y, origin? } |
offset | { x, y } | { x = 0, y = 0 } | Extra offset in rem |
layout | 'row' | 'column' | 'auto' | config.defaultLayout | Arrangement of prompts in the group |
separator | 'slash' | 'line' | 'dot' | 'none' | config.separator | Divider between prompts |
order | number | 0 | CSS order when multiple groups share a slot |
persistOnPause | boolean? | false | Keep this group visible while the pause menu is open |
prompts | PromptEntry | PromptEntry[] | required | One prompt or an array |
entity | number? | Default entity for prompt canInteract / distance | |
coords | vector3? | Default world coords for prompt canInteract / distance |
Prompt entry
A prompt needs a label and at least one of control, keybind, key, keyboard, gamepad, or icon. Prefer control or keybind. Icons are resolved from the live mapping, including player remaps. key / keyboard / gamepad are optional overrides.
| Property | Type | Description |
|---|---|---|
id | string? | Unique id within the group. Defaults to control_N, the keybind name, or the key name |
name | string? | Alias for id |
label | string | Visible label |
control | number? | GTA control index. Presses are tracked, hooks fire, and keyboard/gamepad icons follow the live mapping (including remaps) |
disableControl | boolean? | Disable the GTA control while this prompt is shown, via lib.disableControls |
keybind | string | table? | ox_lib / FiveM keybind name, or the table from lib.addKeybind. Keyboard icon follows the live bind and updates on remap |
key | string | string[]? | Optional icon override (E, LMB, LT). Not needed when control or keybind is set |
keyboard | string | string[]? | Keyboard-only icon override |
gamepad | string | string[]? | Gamepad-only icon override (Xbox layout) |
icon | string | string[]? | Raw image path. Skips icon lookup |
holdTime | number? | Hold duration in ms. Shows the localized hold string before the button, fills a progress bar, and fires onHold / held |
cooldown | number? | Ignore further presses for this many ms after press or hold |
disabled | boolean? | Dimmed, non-interactive |
hidden | boolean? | Omitted from the HUD |
progress | number? | 0 to 1 hold fill |
onPressed | function? | Hook when control is pressed |
onReleased | function? | Hook when control is released |
onHold | function? | Hook when holdTime completes |
onSelect | function? | Action when the prompt fires (press, or hold complete) |
export | string? | Export on the registering resource |
event | string? | Client event to trigger |
serverEvent | string? | Server event to trigger |
command | string? | Command to execute |
groups | string | string[] | table<string, number>? | Job / gang / group filter. Same shape as Interact |
items | string | string[] | table<string, number>? | Required items. Hash values are minimum counts |
anyItem | boolean? | If true, any listed item is enough. Default requires all |
canInteract | fun(entity, distance, coords, name): boolean? | Same signature as Interact. Return false to hide |
allowInVehicle | boolean? | Keep the prompt while in a vehicle. Default hides it |
entity | number? | Entity passed into canInteract and used for distance |
coords | vector3? | World coords passed into canInteract and used for distance |
distance | number? | Hide when farther than this from entity / coords |
{
id = 'engine',
label = 'Engine',
control = 23,
holdTime = 1500,
}Actions
One action runs when the prompt fires, in this order:
onSelectexporteventserverEventcommand
Press fires the action immediately. holdTime waits until the hold completes. onPressed / onHold / onReleased still run as hooks.
{
id = 'lock',
label = 'Lock',
control = 182,
event = 'myresource:lockVehicle',
}
{
id = 'engine',
label = 'Engine',
control = 23,
holdTime = 1500,
serverEvent = 'myresource:toggleEngine',
}
{
id = 'emote',
label = 'Wave',
control = 47,
command = 'e wave',
}The callback or event receives:
| Property | Type | Description |
|---|---|---|
id | string | Prompt id |
name | string | Same as id |
label | string | Visible label |
groupId | string | Group id |
resource | string | Resource that registered the prompt |
entity | number? | Present when the group is tied to a target. Client handle, or a network id for serverEvent. 0 for a coord |
coords | vector3? | World point for that target |
distance | number? | Meters from the player to coords |
coordId | string? | Set for addCoords targets |
export is called as exports[resource][export](nil, data) on the resource that registered the prompt.
Restrictions
Same filters as Interact. A prompt is hidden (and cannot fire) until every check passes. Filters re-run while the group is open.
{
id = 'lockpick',
label = 'Lockpick',
control = 38,
groups = { police = 0, mechanic = 2 },
items = { lockpick = 1 },
allowInVehicle = true,
canInteract = function(entity, distance, coords, name)
return distance < 2.0 and not IsPedDeadOrDying(cache.ped, true)
end,
}groups | Meaning |
|---|---|
'police' | Player has that job, gang, or group |
{ 'police', 'ambulance' } | Any of these names |
{ police = 2, mechanic = 0 } | That group at least this grade |
items | Meaning |
|---|---|
'lockpick' | At least one |
{ 'lockpick', 'advancedlockpick' } | All of these (or any if anyItem = true) |
{ lockpick = 1, repairkit = 2 } | At least these counts |
Jobs and gangs come from the running framework (qbx, qb, esx, ox_core, ND). Item counts use wasabi_inventory when it is started, otherwise ox_inventory.
canInteract is called as canInteract(entity, distance, coords, name), same as Interact. Set entity or coords on the group or the prompt so distance is measured from the player to that point. If neither is set, entity is 0 and coords is the player.
World targets pass the entity or the coord in for you. See World targets.
Live remapping
Open prompts keep their icons in sync with the player's current binds.
| Source | Property | What updates |
|---|---|---|
| GTA control | control | Keyboard and gamepad icons via GetControlInstructionalButton. Remaps in Settings apply immediately |
| FiveM / ox_lib keybind | keybind | Keyboard icon via the live RegisterKeyMapping bind. Remaps under Settings > Key Bindings > FiveM apply immediately |
auto mode also swaps keyboard vs gamepad icons when the last input device changes. key / keyboard / gamepad override the live glyph when you set them.
{ id = 'enter', label = 'Enter', control = 38 }
{ id = 'use', label = 'Use', keybind = 'my_use' }Positions
Named slots:
top-left, top-center, top-right, middle-left, center, middle-right, bottom-left, bottom-center, bottom-right.
Aliases: top, bottom, left, right, center-left, center-right, center-top, center-bottom.
Custom:
prompts.setPosition('vehicle', { x = 82, y = 18, origin = 'top-right' })x and y are percents of the screen. origin is the transform origin (defaults to center).
Gamepad names
Names follow Xbox layout. PlayStation icons remap automatically.
| Name | Xbox | PlayStation |
|---|---|---|
a / cross | A | Cross |
b / circle | B | Circle |
x / square | X | Square |
y / triangle | Y | Triangle |
lt / l2 | LT | L2 |
rt / r2 | RT | R2 |
lb / l1 | LB | L1 |
rb / r1 | RB | R1 |
ls / rs | Left / right stick | Left / right stick |
lsclick / l3 | LS click | L3 |
dpadup dpaddown dpadleft dpadright | D-pad | D-pad |
start / options | Menu | Options |
back / share | View | Share |
Keyboard names include letters, F1 to F12, Shift, Ctrl, Alt, Enter, Space, LMB, RMB, and similar aliases.
Arrays draw combo keys:
{ keyboard = { 'Ctrl', 'E' }, gamepad = 'A', label = 'Interact' }