Kairo TextUI
Exports & API
Exports are client-side. One prompt is visible at a time: the last Show wins.
Show: display a prompt
The first argument is a unique id for your script, the second the options.
Lua
exports.kairo_textui:Show('garage', {
text = 'Open garage',
onPress = function()
OpenGarage()
end,
})Tap and hold on the same prompt
Lua
exports.kairo_textui:Show('atm', {
text = 'Use ATM',
onPress = function() OpenAtm() end,
hold = { text = 'Rob ATM', time = 2000 },
onHold = function() RobAtm() end,
style = 'bracket',
color = 'warning',
})| Option | Type | Description |
|---|---|---|
text | string | Prompt text. |
onPress | function | Called on tap. |
onHold | function | Called when the hold completes. Without it there is no hold. |
hold | table | Subtitle text and time in milliseconds. |
style | string | One of the 15 styles. The player’s choice wins unless configured otherwise. |
color | string | A Config.Colors name or a CSS color. |
progress | string[] | Loading gradient colors. |
key | string | Key label, if you want to force it. |
Callbacks run inside the kairo_textui resource and receive the prompt id. If you need
Wait, start a CreateThread in your own script.Update: change the visible prompt
Change text, color or style without hiding the prompt, such as a door going from locked to unlocked. hold = false removes the hold.
Lua
exports.kairo_textui:Update('door', 'Locked')
exports.kairo_textui:Update('door', { text = 'Unlocked', color = 'success', hold = false })Hide and IsShown
Hide hides the prompt with that id; with no id it hides the visible one. If a resource stops, its prompt disappears on its own.
Lua
exports.kairo_textui:Hide('garage')
local shown = exports.kairo_textui:IsShown('garage')OpenSettings
Opens the player menu from your own scripts, for example from a server menu.
Lua
exports.kairo_textui:OpenSettings()