Text UI

Contextual text displays with markdown support, icons, and keybind indicators

Options

OptionTypeRequiredDefaultDescription
titlestringNonilText UI title
descriptionstringYes*nilMain text content (supports markdown)
positionstringNo'right-center'Position: 'top-left', 'top-center', 'top-right', 'left-center', 'center', 'right-center', 'bottom-left', 'bottom-center', 'bottom-right'
iconstringNonilFontAwesome icon class
iconColorstringNo'#71717A'Icon color (hex or CSS color name)
iconAnimationstringNonilIcon animation: 'spin', 'spinPulse', 'spinReverse', 'pulse', 'beat', 'fade', 'beatFade', 'bounce', 'shake',
keybindstringNonilKeybind text to display
optionstableNonilArray of options for multi-option display

*Either title, description, or options is required.

Option Item Structure

When using the options parameter, each option item supports:

OptionTypeRequiredDefaultDescription
labelstringYesnilOption label text (supports markdown)
iconstringNonilFontAwesome icon class
iconColorstringNoInherits from mainIcon color (hex or CSS color name)
iconAnimationstringNonilIcon animation
keybindstringNonilKeybind text for this option

Markdown

  • Bold text: **text**
  • Italic text: *text*
  • Code text: `text`
  • Line breaks: \n

Functions

-- Show text UI
exports.lation_ui:showText(data)
 
-- Hide text UI
exports.lation_ui:hideText()
 
-- Check if text UI is open
local isOpen, displayText = exports.lation_ui:isOpen()

Return Values

  • isOpen(): isOpen (boolean), displayText (string or nil)

Example

-- Basic text UI
exports.lation_ui:showText({
    description = 'This is a *simple* message with **formatting**'
})
-- Customized text UI prompt
exports.lation_ui:showText({
    title = 'Interaction Available',
    description = 'Press to interact with this object',
    keybind = 'E',
    icon = 'fas fa-hand-paper',
    iconColor = '#3B82F6'
})
-- Multi-option text UI
exports.lation_ui:showText({
    title = 'Controls',
    description = 'Place the object where desired',
    options = {
        {
            label = 'Move Forward',
            icon = 'fas fa-arrow-up',
            keybind = 'W'
        },
        {
            label = 'Move Backward',
            icon = 'fas fa-arrow-down',
            keybind = 'S'
        },
        {
            label = 'Move Left',
            icon = 'fas fa-arrow-left',
            keybind = 'A'
        },
        {
            label = 'Move Right',
            icon = 'fas fa-arrow-right',
            keybind = 'D'
        },
        {
            label = 'Cancel',
            icon = 'fas fa-xmark',
            iconColor = '#EF4444',
            keybind = 'X'
        },
        {
            label = 'Confirm',
            icon = 'fas fa-check',
            iconColor = '#10B981',
            keybind = 'SPACE'
        }
    }
})
-- Check if text UI is open
local isOpen, text = exports.lation_ui:isOpen()
if isOpen then
    print('Text UI is open & currently displaying:', text)
end