# key-interaction

{% hint style="info" %} <mark style="color:yellow;">Key Interaction</mark> is the same as <mark style="color:yellow;">TextUI</mark> but reworked to allow multiple keys. TextUI wasn't removed to maintain compatibility with scripts that are already using it. It doesn't affect anything.
{% endhint %}

## Key Interaction

<figure><img src="https://share.lvsoft.com.ar/images/JryQd.jpg" alt=""><figcaption></figcaption></figure>

***

### How to use:

Client-side using exports

**Example:**

```lua
-- show up key-interaction
-- exports.lvs_lib:keyInteraction(method, items)
exports.lvs_lib:keyInteraction('show', {
    {key= 'E', text= 'Action #1'},
    {key= 'F', text= 'Action #2'},
})

-- simulate keypress and hide key-interaction
-- exports.lvs_lib:keyInteraction(method, [itemIndex])
exports.lvs_lib:keyInteraction('pressed', 1)

-- hide key-interaction
exports.lvs_lib:keyInteraction('hide')

-- key-interaction state
-- isOpen: boolean state
-- options: given table for the keyInteraction show
local isOpen, options = exports.lvs_lib:keyInteraction('isOpen')


```

***


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://fivem.lvsoft.com.ar/qb-esx/lvs-lib/key-interaction.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
