From the reference libraryRedM

Prompt Nui <BadgeClient/>

jo_libs/modules/prompts/prompt-nui/client.md

Prompt Nui <BadgeClient/>

A library to manage NUI-based prompts. This module allows you to create and manage prompt groups with customizable prompts, key bindings, key hold durations, pagination, and visibility controls.

:::tip

  • Keyboard Keys Mapping: You can find the complete list of valid key inputs, including special and function keys, in the Keyboard keys mapping section of the Raw Keys module.
  • Keyboard Layouts: To learn more about switching between QWERTY and AZERTY layouts, see the Setting Keyboard Layout section of the Raw Keys module. :::

JO Functions > jo.promptNui.createGroup()

<!-- @include: ./slots/headers.md#client|jo.promptNui.createGroup -->

Creates a new prompt group with a specified title and optional position. <br>

<!-- @include: ./slots/descriptions.md#client|jo.promptNui.createGroup -->

JO Functions > jo.promptNui.createGroup() > Syntax

jo.promptNui.createGroup(title, position)

JO Functions > jo.promptNui.createGroup() > Parameters

title : string|boolean

The title for the new prompt group. Set to false to have no title

position : string <BadgeOptional />

The screen position for the group. <br> Allowed values are : "bottom-right","center-right","top-right","bottom-left","center-left","top-left" <br> default : "bottom-right"

JO Functions > jo.promptNui.createGroup() > Return Value

Type : GroupClass

A new instance of a prompt group.

<!-- @include: ./slots/examples.md#client|jo.promptNui.createGroup -->

<!-- @include: ./slots/footers.md#client|jo.promptNui.createGroup -->


JO Functions > jo.promptNui.isCompleted()

<!-- @include: ./slots/headers.md#client|jo.promptNui.isCompleted -->

Checks whether a specified key has been held for the required duration to trigger an action.<br>Optionally ensures that the key does not trigger repeatedly unless explicitly allowed. <br>

<!-- @include: ./slots/descriptions.md#client|jo.promptNui.isCompleted -->

JO Functions > jo.promptNui.isCompleted() > Syntax

jo.promptNui.isCompleted(group, key, fireMultipleTimes)

JO Functions > jo.promptNui.isCompleted() > Parameters

group : GroupClass|string

The prompt group to validate against. Retrocompatible: can be the key string.

key : string|boolean|nil

The key identifier to check. Retrocompatible: can be fireMultipleTimes.

fireMultipleTimes : boolean|nil <BadgeOptional />

If true, allows the key to trigger multiple times<br> defaults to false.

JO Functions > jo.promptNui.isCompleted() > Return Value

Type : boolean

True if the key press is complete and valid, otherwise false.

<!-- @include: ./slots/examples.md#client|jo.promptNui.isCompleted -->

<!-- @include: ./slots/footers.md#client|jo.promptNui.isCompleted -->


JO Functions > jo.promptNui.isDisplayed()

<!-- @include: ./slots/headers.md#client|jo.promptNui.isDisplayed -->

<!-- @include: ./slots/descriptions.md#client|jo.promptNui.isDisplayed -->

JO Functions > jo.promptNui.isDisplayed() > Syntax

jo.promptNui.isDisplayed()

<!-- @include: ./slots/examples.md#client|jo.promptNui.isDisplayed -->

<!-- @include: ./slots/footers.md#client|jo.promptNui.isDisplayed -->

GroupClass Methods > GroupClass:addPrompt()

<!-- @include: ./slots/headers.md#client|GroupClass:addPrompt -->

Adds a new prompt to the group on a specified page. <br>Creates or initializes pages as necessary, assigns the prompt's position, and returns the new prompt. <br>

<!-- @include: ./slots/descriptions.md#client|GroupClass:addPrompt -->

GroupClass Methods > GroupClass:addPrompt() > Syntax

GroupClass:addPrompt(key, label, holdTime, page)

GroupClass Methods > GroupClass:addPrompt() > Parameters

key : string

A key string for the prompt.

label : string

The descriptive label for the prompt.

holdTime : number|boolean

Duration to hold the key before the prompt triggers. <br> Set it to false if no hold time is required

page : number <BadgeOptional />

The page number to add the prompt to<br> defaults to 1.

GroupClass Methods > GroupClass:addPrompt() > Return Value

Type : PromptClass

The newly created prompt object.

<!-- @include: ./slots/examples.md#client|GroupClass:addPrompt -->

<!-- @include: ./slots/footers.md#client|GroupClass:addPrompt -->


GroupClass Methods > GroupClass:display()

<!-- @include: ./slots/headers.md#client|GroupClass:display -->

Displays the prompt group on the NUI interface and sets up key listeners for the active page. If the group has multiple pages, it also configures pagination using the nextPageKey. <br>

<!-- @include: ./slots/descriptions.md#client|GroupClass:display -->

GroupClass Methods > GroupClass:display() > Syntax

GroupClass:display(page)

GroupClass Methods > GroupClass:display() > Parameters

page : number <BadgeOptional />

The page number to display<br> defaults to the group's current page.

<!-- @include: ./slots/examples.md#client|GroupClass:display -->

<!-- @include: ./slots/footers.md#client|GroupClass:display -->


GroupClass Methods > GroupClass:forceDisplay()

<!-- @include: ./slots/headers.md#client|GroupClass:forceDisplay -->

<!-- @include: ./slots/descriptions.md#client|GroupClass:forceDisplay -->

GroupClass Methods > GroupClass:forceDisplay() > Syntax

GroupClass:forceDisplay()

<!-- @include: ./slots/examples.md#client|GroupClass:forceDisplay -->

<!-- @include: ./slots/footers.md#client|GroupClass:forceDisplay -->


GroupClass Methods > GroupClass:forceHide()

<!-- @include: ./slots/headers.md#client|GroupClass:forceHide -->

<!-- @include: ./slots/descriptions.md#client|GroupClass:forceHide -->

GroupClass Methods > GroupClass:forceHide() > Syntax

GroupClass:forceHide()

<!-- @include: ./slots/examples.md#client|GroupClass:forceHide -->

<!-- @include: ./slots/footers.md#client|GroupClass:forceHide -->


GroupClass Methods > GroupClass:hide()

<!-- @include: ./slots/headers.md#client|GroupClass:hide -->

Hides the prompt group from the NUI interface and removes its active key listeners. <br>

<!-- @include: ./slots/descriptions.md#client|GroupClass:hide -->

GroupClass Methods > GroupClass:hide() > Syntax

GroupClass:hide()

<!-- @include: ./slots/examples.md#client|GroupClass:hide -->

<!-- @include: ./slots/footers.md#client|GroupClass:hide -->


GroupClass Methods > GroupClass:isVisible()

<!-- @include: ./slots/headers.md#client|GroupClass:isVisible -->

Returns whether the group is currently visible. <br>

<!-- @include: ./slots/descriptions.md#client|GroupClass:isVisible -->

GroupClass Methods > GroupClass:isVisible() > Syntax

GroupClass:isVisible()

GroupClass Methods > GroupClass:isVisible() > Return Value

Type : boolean

true if the group is visible, false otherwise

<!-- @include: ./slots/examples.md#client|GroupClass:isVisible -->

<!-- @include: ./slots/footers.md#client|GroupClass:isVisible -->


GroupClass Methods > GroupClass:new()

<!-- @include: ./slots/headers.md#client|GroupClass:new -->

<!-- @include: ./slots/descriptions.md#client|GroupClass:new -->

GroupClass Methods > GroupClass:new() > Syntax

GroupClass:new()

<!-- @include: ./slots/examples.md#client|GroupClass:new -->

<!-- @include: ./slots/footers.md#client|GroupClass:new -->


GroupClass Methods > GroupClass:refreshNUI()

<!-- @include: ./slots/headers.md#client|GroupClass:refreshNUI -->

Refreshes the NUI interface for the group by updating a specified property. This update is only sent if the group is currently visible. <br>

<!-- @include: ./slots/descriptions.md#client|GroupClass:refreshNUI -->

GroupClass Methods > GroupClass:refreshNUI() > Syntax

GroupClass:refreshNUI(property)

GroupClass Methods > GroupClass:refreshNUI() > Parameters

property : string

The group property to update (e.g., "title", "position",..).

<!-- @include: ./slots/examples.md#client|GroupClass:refreshNUI -->

<!-- @include: ./slots/footers.md#client|GroupClass:refreshNUI -->


GroupClass Methods > GroupClass:setNextPageKey()

<!-- @include: ./slots/headers.md#client|GroupClass:setNextPageKey -->

Sets the key used for navigating to the next page of prompts. <br>

<!-- @include: ./slots/descriptions.md#client|GroupClass:setNextPageKey -->

GroupClass Methods > GroupClass:setNextPageKey() > Syntax

GroupClass:setNextPageKey(key)

GroupClass Methods > GroupClass:setNextPageKey() > Parameters

key : string

The key string to be used for pagination.

<!-- @include: ./slots/examples.md#client|GroupClass:setNextPageKey -->

<!-- @include: ./slots/footers.md#client|GroupClass:setNextPageKey -->


GroupClass Methods > GroupClass:setPosition()

<!-- @include: ./slots/headers.md#client|GroupClass:setPosition -->

Sets the display position for the prompt group. <br>

<!-- @include: ./slots/descriptions.md#client|GroupClass:setPosition -->

GroupClass Methods > GroupClass:setPosition() > Syntax

GroupClass:setPosition(position)

GroupClass Methods > GroupClass:setPosition() > Parameters

position : string

The screen position for the group. <br> Allowed values are : "bottom-right","center-right","top-right","bottom-left","center-left","top-left"

<!-- @include: ./slots/examples.md#client|GroupClass:setPosition -->

<!-- @include: ./slots/footers.md#client|GroupClass:setPosition -->


GroupClass Methods > GroupClass:setTitle()

<!-- @include: ./slots/headers.md#client|GroupClass:setTitle -->

Sets the title for the prompt group. <br>

<!-- @include: ./slots/descriptions.md#client|GroupClass:setTitle -->

GroupClass Methods > GroupClass:setTitle() > Syntax

GroupClass:setTitle(title)

GroupClass Methods > GroupClass:setTitle() > Parameters

title : string

The title to assign to the group.

<!-- @include: ./slots/examples.md#client|GroupClass:setTitle -->

<!-- @include: ./slots/footers.md#client|GroupClass:setTitle -->

PromptClass Methods > PromptClass:getLabel()

<!-- @include: ./slots/headers.md#client|PromptClass:getLabel -->

Get the label text for the prompt. <br>

<!-- @include: ./slots/descriptions.md#client|PromptClass:getLabel -->

PromptClass Methods > PromptClass:getLabel() > Syntax

PromptClass:getLabel()

PromptClass Methods > PromptClass:getLabel() > Return Value

Type : string

The text label assigned to the prompt.

<!-- @include: ./slots/examples.md#client|PromptClass:getLabel -->

<!-- @include: ./slots/footers.md#client|PromptClass:getLabel -->


PromptClass Methods > PromptClass:isVisible()

<!-- @include: ./slots/headers.md#client|PromptClass:isVisible -->

Returns whether the prompt is currently visible. <br>

<!-- @include: ./slots/descriptions.md#client|PromptClass:isVisible -->

PromptClass Methods > PromptClass:isVisible() > Syntax

PromptClass:isVisible()

PromptClass Methods > PromptClass:isVisible() > Return Value

Type : boolean

true if the prompt is visible, false otherwise

<!-- @include: ./slots/examples.md#client|PromptClass:isVisible -->

<!-- @include: ./slots/footers.md#client|PromptClass:isVisible -->


PromptClass Methods > PromptClass:new()

<!-- @include: ./slots/headers.md#client|PromptClass:new -->

<!-- @include: ./slots/descriptions.md#client|PromptClass:new -->

PromptClass Methods > PromptClass:new() > Syntax

PromptClass:new()

<!-- @include: ./slots/examples.md#client|PromptClass:new -->

<!-- @include: ./slots/footers.md#client|PromptClass:new -->


PromptClass Methods > PromptClass:refreshNUI()

<!-- @include: ./slots/headers.md#client|PromptClass:refreshNUI -->

Refreshes the NUI interface for a prompt, updating a specific property. This update is only performed if the prompt belongs to the currently visible group. <br>

<!-- @include: ./slots/descriptions.md#client|PromptClass:refreshNUI -->

PromptClass Methods > PromptClass:refreshNUI() > Syntax

PromptClass:refreshNUI(property)

PromptClass Methods > PromptClass:refreshNUI() > Parameters

property : string

The property name to update (e.g., "label", "disabled").

<!-- @include: ./slots/examples.md#client|PromptClass:refreshNUI -->

<!-- @include: ./slots/footers.md#client|PromptClass:refreshNUI -->


PromptClass Methods > PromptClass:setEnabled()

<!-- @include: ./slots/headers.md#client|PromptClass:setEnabled -->

Enables or disables the prompt and updates its associated key listeners. <br>

<!-- @include: ./slots/descriptions.md#client|PromptClass:setEnabled -->

PromptClass Methods > PromptClass:setEnabled() > Syntax

PromptClass:setEnabled(enabled)

PromptClass Methods > PromptClass:setEnabled() > Parameters

enabled : boolean

true to enable the prompt, false to disable it.

<!-- @include: ./slots/examples.md#client|PromptClass:setEnabled -->

<!-- @include: ./slots/footers.md#client|PromptClass:setEnabled -->


PromptClass Methods > PromptClass:setHoldTime()

<!-- @include: ./slots/headers.md#client|PromptClass:setHoldTime -->

Sets the key hold duration for the prompt. <br>

<!-- @include: ./slots/descriptions.md#client|PromptClass:setHoldTime -->

PromptClass Methods > PromptClass:setHoldTime() > Syntax

PromptClass:setHoldTime(holdTime)

PromptClass Methods > PromptClass:setHoldTime() > Parameters

holdTime : number|boolean

Duration (in milliseconds) the key must be held before activation; false if not applicable.

<!-- @include: ./slots/examples.md#client|PromptClass:setHoldTime -->

<!-- @include: ./slots/footers.md#client|PromptClass:setHoldTime -->


PromptClass Methods > PromptClass:setKeyboardKeys()

<!-- @include: ./slots/headers.md#client|PromptClass:setKeyboardKeys -->

Configures the keyboard keys for the prompt. Ensures that the keys are stored in a table, converting a single key to uppercase if needed. <br>

<!-- @include: ./slots/descriptions.md#client|PromptClass:setKeyboardKeys -->

PromptClass Methods > PromptClass:setKeyboardKeys() > Syntax

PromptClass:setKeyboardKeys(keyboardKeys)

PromptClass Methods > PromptClass:setKeyboardKeys() > Parameters

keyboardKeys : table|string

A table of key strings or a single key string.

<!-- @include: ./slots/examples.md#client|PromptClass:setKeyboardKeys -->

<!-- @include: ./slots/footers.md#client|PromptClass:setKeyboardKeys -->


PromptClass Methods > PromptClass:setLabel()

<!-- @include: ./slots/headers.md#client|PromptClass:setLabel -->

Sets the label text for the prompt. <br>

<!-- @include: ./slots/descriptions.md#client|PromptClass:setLabel -->

PromptClass Methods > PromptClass:setLabel() > Syntax

PromptClass:setLabel(label)

PromptClass Methods > PromptClass:setLabel() > Parameters

label : string

The text label to assign to the prompt.

<!-- @include: ./slots/examples.md#client|PromptClass:setLabel -->

<!-- @include: ./slots/footers.md#client|PromptClass:setLabel -->


PromptClass Methods > PromptClass:setVisible()

<!-- @include: ./slots/headers.md#client|PromptClass:setVisible -->

Sets the visibility of the prompt and updates its enabled state accordingly. <br>

<!-- @include: ./slots/descriptions.md#client|PromptClass:setVisible -->

PromptClass Methods > PromptClass:setVisible() > Syntax

PromptClass:setVisible(visible)

PromptClass Methods > PromptClass:setVisible() > Parameters

visible : boolean

true to show the prompt, false to hide it.

<!-- @include: ./slots/examples.md#client|PromptClass:setVisible -->

<!-- @include: ./slots/footers.md#client|PromptClass:setVisible -->

GroupClass Methods > GroupClass:addPrompt() > Syntax

GroupClass:addPrompt(key, label, holdTime, page, price)

GroupClass Methods > GroupClass:addPrompt() > Parameters

key : string

A key string for the prompt.

label : string

The descriptive label for the prompt.

holdTime : number|boolean

Duration to hold the key before the prompt triggers. <br> Set it to false if no hold time is required

page : number <BadgeOptional />

The page number to add the prompt to<br> defaults to 1.

price : table|integer|number|boolean <BadgeOptional />

The price to display next to the prompt label. Uses the shared pricing structure <br> defaults to false.

GroupClass Methods > GroupClass:addSeparator()

<!-- @include: ./slots/headers.md#client|GroupClass:addSeparator -->

Adds a visual separator to the group on a specified page. <br>

<!-- @include: ./slots/descriptions.md#client|GroupClass:addSeparator -->

GroupClass Methods > GroupClass:addSeparator() > Syntax

GroupClass:addSeparator(page)

GroupClass Methods > GroupClass:addSeparator() > Parameters

page : number <BadgeOptional />

The page number to add the separator to<br> defaults to 1.

<!-- @include: ./slots/examples.md#client|GroupClass:addSeparator -->

<!-- @include: ./slots/footers.md#client|GroupClass:addSeparator -->


PromptClass Methods > PromptClass:setPrice()

<!-- @include: ./slots/headers.md#client|PromptClass:setPrice -->

Sets the prompt price and formats it with the shared pricing structure. <br>

<!-- @include: ./slots/descriptions.md#client|PromptClass:setPrice -->

PromptClass Methods > PromptClass:setPrice() > Syntax

PromptClass:setPrice(price)

PromptClass Methods > PromptClass:setPrice() > Parameters

price : table|integer|number|boolean|nil

The prompt price. Set it to false if no price is required

<!-- @include: ./slots/examples.md#client|PromptClass:setPrice -->

<!-- @include: ./slots/footers.md#client|PromptClass:setPrice -->


Back to documentation