↑↓ select · Enter open

PrettyUI

A UI library that makes it easy to craft native-looking interfaces for your RuneScape API plugins.

Installation

Declare PrettyUI as a required external plugin dependency in plugin.json, using its mod.io ID 6398181. RuneScape loads PrettyUI first and exposes its returned table under the dependency alias prettyui.

{
  "name": "My Plugin",
  "version": "1.0.0",
  "requiredDependencies": {
    "prettyui": 6398181
  },
  "optionalDependencies": {}
}

Editor integration

The LuaLS addon provides autocomplete and type checking in VS Code’s Lua extension, Neovim, and other LuaLS clients.

  1. Download PrettyUI-luals-addon-<tag>.zip from the GitHub Release matching your PrettyUI version.

  2. Extract it into an addon collection outside your plugin folder. The config should be at /path/to/LuaAddons/prettyui-luals-addon/config.json.

  3. Add the collection directory (not the addon itself) to your workspace’s .luarc.json, preserving existing settings:

    {
      "workspace.userThirdParty": ["/path/to/LuaAddons"],
      "workspace.checkThirdParty": "Ask"
    }
    
  4. Replace the example path with your actual directory, reload LuaLS, open code using prettyui., and accept the addon prompt.

Alternatively, add the addon’s library/ directory to workspace.library. When upgrading, replace the addon directory and reload LuaLS; load only one version.

SettingsLayer

Mount a SimpleView on event.component and add PrettyUI settings controls with its Add... methods.

Requires the PrettyUI dependency and "hasSettingsIcon": true in your manifest.

local settingsView
local showHints = PersistentDB:GetBool("showHints") ~= false

Event.SettingsLayerReady.Subscribe("my-plugin-settings", function(event)
    if settingsView then settingsView:Destroy() end

    local parent = event.component
    settingsView = prettyui.SimpleView.new(parent, {
        width = parent.width,
        height = parent.height,
    })

    settingsView:AddTitle("My Plugin settings")
    settingsView:AddText("Changes are saved immediately.")
    settingsView:AddCheckboxButton({
        { text = "Show hints", value = "showHints", selected = showHints },
    }, {
        onChange = function(_, _, _, selected)
            showHints = selected
            PersistentDB:SetBool("showHints", selected)
        end,
    })
end)

function PluginShutdown()
    Event.SettingsLayerReady.Unsubscribe("my-plugin-settings")
    if settingsView then
        settingsView:Destroy()
        settingsView = nil
    end
end

Destroy the previous view when remounting, and include its teardown in your existing PluginShutdown. When using both examples, combine their cleanup in that one function.

SimpleView uses the supplied width and height; call settingsView:SetSize(width, height) if the available space changes.

ContentLayer

Use SimpleView to add PrettyUI flow layout and scrolling to event.component, without a separate window frame.

Requires the PrettyUI dependency and "hasRibbonIcon": true in your manifest.

local contentView
local clicks = 0

Event.ContentLayerReady.Subscribe("my-plugin-content", function(event)
    if contentView then contentView:Destroy() end

    local parent = event.component
    contentView = prettyui.SimpleView.new(parent, {
        width = parent.width,
        height = parent.height,
    })

    contentView:AddTitle("My Plugin")
    contentView:AddText("This content is mounted inside the client's Plugins window.")
    local countLabel = contentView:AddText("Clicks: " .. tostring(clicks))
    contentView:AddSimpleButton("Count a click", function()
        clicks = clicks + 1
        countLabel.content = "Clicks: " .. tostring(clicks)
    end)
end)

function PluginShutdown()
    Event.ContentLayerReady.Unsubscribe("my-plugin-content")
    if contentView then
        contentView:Destroy()
        contentView = nil
    end
end

AddText returns a ui.Text; update its content property to change the label.

Destroy the previous view when remounting, and merge its teardown into your existing PluginShutdown. Destroy the view, not its parent.

Scrolling is automatic when content overflows. Call contentView:SetSize(width, height) if the available space changes.

Layout and scale

Components added through Add… helpers participate in automatic flow. Text wraps to the available width, and following components move when content grows, collapses, or is removed.

Flow placement. Use inline = true to join the current row. Supplying y or absolute = true opts only that component out of flow. Interactive children continue forwarding wheel input to their owning scrollable content host.

Interface scale. Dimensions use API interface units; the client applies the user’s Interface Scale setting automatically.

Shared component options

Windows, panels, tab pages, and simple views place every content component through the same flow layout. This encapsulates every prettyUI component.

window:AddText({
    text = "Status",
    marginTop = 12,
})

window:AddSimpleButton("Refresh", refresh)
window:AddSpriteButton("SETTINGS", openSettings, {
    inline = true,
    columnGap = 8,
    tooltip = "Open settings",
})

Flow placement

inline
Joins the current row instead of starting below it.
offsetY
Offsets a component vertically when it joins an existing row with inline = true, without opting out of flow.
marginTop, marginBottom
Overrides the component’s normal vertical spacing.
columnGap
Changes the space after this component before the next inline component.
absolute or y
Opts the component out of automatic flow.

Common presentation

x, y
Position offsets in interface units.
xAnchor, yAnchor
Parent-relative position anchors.
width, height, size
Component dimensions when supported.
widthAnchor, heightAnchor
Parent-relative size anchors when supported.
tooltip
A string or tooltip options table.

Allocation

categoryID
Set “auto” on a root to allocate managed IDs for its component tree. Omitted selection keeps native inheritance. See Component IDs.

Dynamic data

PrettyUI components are live objects rather than one-time templates. Keep the values returned by constructors and Add… helpers, then update them when your plugin state changes. Native properties update directly, while stateful PrettyUI components expose methods that also refresh their visuals and internal state.

Update several component types

local status = window:AddText({
    text = "Waiting...",
    height = 24,
    maxLines = 1,
})

local progress = window:AddSlider({
    min = 0,
    max = 100,
    value = 0,
})

local action = window:AddFancyButton("Start", startTask)
local reward = window:AddItemSlot(config.Obj.STEEL_BAR, {
    quantity = 1,
})

local function render(state)
    status.content = state.message
    progress:SetValue(state.percent, false)
    action:SetText(state.running and "Cancel" or "Start")
    action:SetDisabled(state.locked)
    reward:SetQuantity(state.rewardQuantity)
end

render({
    message = "Processing rewards...",
    percent = 65,
    running = true,
    locked = false,
    rewardQuantity = 12,
})

Continuously updated values

Call the same setters from the event that owns the data. This example updates a label and progress control from the client logic tick:

Event.Logic.Subscribe("my_plugin_live_status", function(event)
    local percent = event.logicTick % 101
    status.content = "Client tick: " .. tostring(event.logicTick)
    progress:SetValue(percent, false)
end)

function PluginShutdown()
    Event.Logic.Unsubscribe("my_plugin_live_status")
end

Classic UI detection

local isClassicUI = prettyui.IsClassicUI()

Returns true for Classic Interface and false for Modern Interface. Reads the current TOPLEVEL_V2_LEGACY_INTERFACE varbit on every call.

To react to mode changes, watch Event.VarTransmit for event.var.id == id.VarPlayer.TOPLEVEL_V2_GENERAL_VARP, then call prettyui.IsClassicUI() again. The helper does not create subscriptions.

Common update patterns

Native component properties
Assign values such as text.content directly.
PrettyUI setters
Use methods such as SetText, SetValue, SetDisabled, SetObject, and SetQuantity.
Callbacks and events
Refresh from control callbacks, RuneScape events, HTTP responses, or your own state transitions.

Keep updates predictable

Suppress callbacks when rendering
Where supported, pass false to a setter such as SetValue(value, false) to avoid feeding a programmatic update back into onChange.
Clean up subscriptions
Unsubscribe plugin-owned events during PluginShutdown.
Account for layout
Changing a value redraws its component, but does not automatically resize every flow row. After changing content in place, such as a label’s text, call RefreshLayout().

Component IDs

Set categoryID = "auto" on a root window, view, panel, or component for higher-capacity allocation. Children and later Add calls inherit the choice. NisPanel is the exception: it uses automatic allocation when categoryID is omitted.

local window = prettyui.Window.new(parent, {
    categoryID = "auto",
    title = "Example",
})
window:AddText("Inherits automatic allocation")

local layer = prettyui.NewComponent(ui.Layer, window.content)
prettyui.NewComponent(ui.Text, layer)

Owned tooltips, dropdowns, and other detached controls retain the owner’s policy. Separately constructed roots need their own opt-in unless they are NisPanel instances. Shared parents and sibling trees are not changed.

Allocation rules

categoryID = "auto"
Assigns free nonzero category/dynamic-ID pairs to managed controls and decorations of any native type. Numeric categories are not a PrettyUI option.
Omitted categoryID
NisPanel defaults to automatic allocation. Other components keep native parent-category inheritance and emit one migration warning per loaded allocator module. Omitting the option for those components will be deprecated in a future version.
Static parents
Use native root ID assignment even in auto mode. Their PrettyUI descendants retain the auto policy.
Content hosts
Stay in category 0 for raw-native children: Window and scrolling content, Tabs pages, both Panel surfaces, CollapseButton content, tooltips, and List rows. Managed children still use nonzero categories.
Mounting
Auto content hosts require a static or category-zero parent. Dynamic nonzero parents are rejected before construction. Category-zero capacity remains finite.

Custom native components

NewComponent(nativeType, parent, options)
Constructs a native component with the inherited policy and fresh ID checks. The optional options table accepts categoryID = “auto” for a standalone opt-in.
BuildCategoryGroup(parent, count, builder)
Reserves 1..235 contiguous nonzero IDs. Calls builder(new); create exactly count components with new(nativeType, dynamicParent). Group-created components pass auto allocation to ordinary PrettyUI descendants.
WithCategoryBatch(parent, callback)
Supplies callback(build) with build(count, builder) for repeated groups. Active reservations remain protected during builder callbacks.
RefreshComponentIDs(parent)
Reconciles cached occupancy after raw construction or deletion. Fresh collision checks do not require a manual refresh.
local row = prettyui.BuildCategoryGroup(window.content, 2, function(new)
    local root = new(ui.Layer, window.content)
    new(ui.Text, root)
    return root
end)

Raw ui.*.new calls bypass PrettyUI’s ID guards. Raw overflow, invalid explicit IDs, or raw children beneath managed nonzero controls can still crash the client. Use NewComponent or reserved groups for guarded custom construction; pcall cannot catch a native crash.

Window

local gameArea = ui.Interfaces:GetComponent(id.Component.TOPLEVEL_V2__GAME_AREA)

local settingsWindow = prettyui.Window.new(gameArea, {
    categoryID = "auto",
    title = "Plugin settings",
    x = -210,
    y = -150,
    xAnchor = 0.5,
    yAnchor = 0.5,
    width = 420,
    height = 300,
    resizable = true,
    minWidth = 320,
    minHeight = 220,
    maxWidth = 900,
    maxHeight = 700,
    scrollable = true,
    rowBackgroundColours = {
        0x24211EFF,
        0x2E2825FF,
    },
    onClose = function(window)
        saveSettings()
    end,
})

settingsWindow:AddTitle("Display")
settingsWindow:AddText("Configure the interface below.")
settingsWindow:RefreshRowBackgrounds()

settingsWindow:SetTitle("Updated settings")
settingsWindow:SetSize(460, 320)
settingsWindow:Show()

-- Hide the window and invoke onClose.
settingsWindow:Close()

-- Destroy it during plugin shutdown.
settingsWindow:Destroy()

Construction

Window.new(parent, options)

Creates an independent window state object.

Window content is vertically scrollable by default. Its scrollbar remains hidden and leaves the full content width available until managed content exceeds the viewport height.

Titled windows can be moved by dragging their title bar. Their position stays within the parent when their dimensions permit and is retained proportionally when the parent is resized. Interactive resizing is opt-in with resizable = true.

categoryID
Optional “auto” allocation for the window’s component tree. See Component IDs.
title
Optional string. Omitting it switches to the plain top border.
x, y
Initial position in interface units.
xAnchor, yAnchor
Optional offsets based on the parent’s dimensions. To centre a fixed-size window, use 0.5 for both anchors and negative half-width/half-height for x and y.
width, height
Initial dimensions.
resizable
Enables interactive resizing from all four edges and four corners. Defaults to false.
minWidth, minHeight
Lower bounds used by interactive resizing and SetSize. Defaults to 220 × 140 interface units.
maxWidth, maxHeight
Optional upper bounds used by interactive resizing and SetSize.
onClose
Callback receiving the window object.
hideCloseButton
Allows a window to be created without a Close Button. Ensure you provide an alternative way to close the window Close() will work.
onPositionChange
Receives (window, x, y) once after a completed drag changes position. Coordinates are parent-relative interface units. Programmatic moves and cancelled drags do not notify. To persist, save x and y and restore them as constructor options without xAnchor or yAnchor.
destroyOnClose
Destroy instead of hide when true.
useNativeTransparency
Makes the window match the player’s native interface transparency setting. Defaults to false.
respectInterfaceLock
In Modern UI, prevents moving and resizing while the interface is locked and the player’s PrettyUI lock setting is enabled. Defaults to true.
snapToEdges
Snaps the dragged window to edges within 12 interface units: other PrettyUI windows, the game’s own interfaces that use snapping, and the screen. Defaults to true.
scrollable
Enables automatic vertical scrolling. Defaults to true.
scrollStep
Interface units moved per wheel delta. Defaults to 32.
contentHeight
Optional initial content height for raw or manually positioned children. Content added with Add… helpers is measured automatically.
rowBackgroundColours, rowBackgroundColors
Alternates row background colours to match native settings panels. See Row backgrounds.
rowBackgroundEdgeToEdge
Extends the backgrounds to the content edges. Defaults to false.

Methods and fields

content
Layer used as the parent for consumer UI.
viewport
Clipped layer that owns content.
scrollbarVisible
True while content exceeds the viewport and scrollable is enabled.
scrollY, contentHeight, contentWidth
Current scroll position and measured content dimensions.
SetScrollable(value)
Enables or disables scrolling. Disabling resets the viewport to the top and restores the full content width.
SetScrollPosition(y), ScrollBy(delta)
Moves the viewport to an absolute or relative vertical position.
ScrollToChild(child, topOffset)
Scrolls to a direct content child with an optional top offset.
SetContentHeight(height)
Updates overflow detection for raw content not managed through Add… helpers.
RefreshRowBackgrounds()
Rebuilds row backgrounds after content or layout changes. Call it after adding, removing, or repositioning managed children.
SetSize(width, height)
Changes dimensions programmatically, subject to the configured minimum and maximum dimensions.
SetTitle(title)
Updates an existing title label.
SetUseNativeTransparency(enabled)
Changes useNativeTransparency. Turning it off makes the background opaque.
SetRespectInterfaceLock(enabled)
Changes respectInterfaceLock for this window in Modern UI.
Show()
Shows and raises the window.
Hide()
Hides the window without invoking onClose.
Close()
Invokes onClose, then hides or destroys the window. Invoked automatically when the end user closes a window with the ‘X’ button.
Destroy()
Destroys the complete component tree.

NisPanel

A draggable, resizable panel that follows the player’s interface lock and background transparency settings. Panels can share tabs with other NisPanels or compatible native windows. In Classic Interface, they use a shared right sidebar.

local panel = prettyui.NisPanel.new({
    id = "my-plugin:encounter",
    x = 80,
    y = 80,
    width = 300,
    height = 180,
    tabIcon = id.Sprite.CHILD_TAB_ICON_NOTES,
    tabText = "Encounter",
    buildContent = function(view)
        view:AddTitle("Encounter")
        view:AddText("No active encounter.")
    end,
})

-- During plugin shutdown:
panel:Destroy()

Construction

NisPanel.new(options?)
NisPanel.new(parent, options?)

The default parent is TOPLEVEL_V2__GAME_AREA, which must be available before construction. Pass an explicit parent for a custom mount.

id
Stable, globally unique ID, such as “my-plugin:encounter”. Saves enabled state, bounds, tab membership, order, and selection across sessions. Omit for a transient panel. Duplicate live IDs are rejected.
dockTo
Another panel’s id as the initial docking target; it may be created later. Requires id. Saved layouts override initial position, size, anchors, and dockTo.
active
Starts enabled by default. Set false to defer opening to the ribbon. Saved enabled state overrides this default.
categoryID
Defaults to “auto”. See Component IDs.
x, y, xAnchor, yAnchor
Initial parent-relative position and optional proportional anchors. Omitted coordinates place the panel beside the ribbon on first enable.
width, height
Optional dimensions in interface units. Defaults to 300 × 400.
minWidth, minHeight, maxWidth, maxHeight
Limits for resizing and SetSize. Minimums default to 64 × 21; maximums are optional.
tabIcon
A loaded Plugin.resources image or a built-in id.Sprite ID such as id.Sprite.CHILD_TAB_ICON_NOTES. This sets the icon for the tab and ribbon button. tabText
Hover text for the tab and automatic ribbon button. Defaults to “Panel”.
buildContent(panel)
Builds content when the page becomes selected. Use panel:Add… helpers or panel.content. May return a cleanup function; see Content lifecycle below.
onBoundsChange(panel, x, y, width, height)
Called after committed bounds changes, in parent-relative interface units. Identified panels save placement automatically.
onClose(panel)
Called by Close() after deactivation, before optional destruction.
destroyOnClose
Destroy instead of hide when true. Defaults to false.

Content lifecycle

Create controls inside buildContent, not after construction. Switching tabs, disabling the panel, or collapsing the Classic sidebar releases its content. Selecting it again calls buildContent and restores its scroll position. Resizing and interface locking do not rebuild content.

Keep persistent values in plugin state: control handles are invalid after cleanup. The returned cleanup function runs first, then OnCleanup callbacks and managed unsubscriptions in reverse registration order, before controls are destroyed. Cleanup also runs on Destroy() or a failed build.

Subscribe(event, callback)
Subscribes to a native event, such as Event.Logic, while content is mounted. Automatically unsubscribes on cleanup; no key is needed. Use plugin-owned subscriptions for updates that must continue while the panel is closed.
OnCleanup(callback)
Registers mount-scoped cleanup. Call this and Subscribe only inside buildContent or while content is mounted.
AddText, AddTitle, Add…
Shared layout and flow helpers.
content, viewport
Content parent and clipped viewport; nil while unmounted. Use content as the parent for custom controls, including in Classic Interface.
scrollable, scrollStep, contentHeight
Shared scrolling options. Scrolling defaults to true with a step of 32; managed content is measured automatically.
SetScrollable(value), SetScrollPosition(y), ScrollBy(delta),
ScrollToChild(child, topOffset), SetContentHeight(height)
Shared scrolling methods.
scrollbarVisible, scrollY, contentHeight, contentWidth
Scrollbar visibility, current scroll position, and measured content dimensions.
layout, textLayout
Shared flow configuration; textLayout is an alias for layout.
rowBackgroundColours, rowBackgroundColors, rowBackgroundEdgeToEdge
Shared row background options.
RefreshRowBackgrounds()
Rebuilds row backgrounds after content or layout changes.
tooltip, SetTooltip(value)
Set or replace the panel’s tooltip. Pass nil to remove it.

Docking and visibility

While unlocked, drag panels together to group them, drag tabs to reorder, or drag a tab out to detach it. Native docking requires a direct mount on TOPLEVEL_V2__GAME_AREA and a compatible native tab band or window header. Only the selected page builds content.

If when enabled a standalone panel is covering more than half of another NisPanel, it will dock to it.

Saved native membership restores when its host becomes available; until then, the panel remains standalone. Docked content can draw above overlapping native windows rather than following native window occlusion.

DockTo(target)
Joins and selects a panel group. Both panels must be visible, unlocked, on the same parent, with target dimensions satisfying every member’s size limits. Group minimum height is 49. For existing groups, pass their active panels to merge them. Also accepts a compatible native frame component or packed frame component ID. Returns false when docking is unavailable, including in Classic Interface. Use dockTo for startup defaults.
Undock()
Detaches and saves the panel as standalone. Native docking restores its previous standalone bounds; PrettyUI groups retain their current bounds. No-op in Classic Interface.
SelectTab()
Selects this panel’s tab, or enables and selects its Classic sidebar page.
SetSize(width, height)
Resizes the panel or its PrettyUI group within configured limits. No-op when native-docked or in Classic Interface, where the host owns sizing.
SetActive(active), IsActive()
Sets or reads enabled state, independently of tab selection. Disabling releases content and removes the tab but remembers placement. Enabling restores placement and selects the panel, including while locked.
Show()
Enables, selects, and raises the panel.
Hide()
Equivalent to SetActive(false); does not call onClose.
Close()
Deactivates, calls onClose, then optionally destroys the panel. Also used by the close button, visible only while unlocked.
Destroy()
Cleans up content and removes the panel and ribbon button without forgetting saved state. Call during plugin shutdown. Hide() and Close() retain the ribbon button for reopening unless destroyOnClose is true.

Automatic panel ribbon

Panels automatically use a ribbon in Modern Interface or a sidepanel in Classic Interface, depending on the user’s UI mode.

Scrolling and SimpleView

Windows, panels, tab pages, and SimpleView use the same vertical scroll core. Scrolling defaults to enabled, but no gutter or scrollbar is shown until content actually overflows. Wheel input, arrow buttons, track clicks, and thumb dragging stay synchronized; nested scroll areas pass wheel input to their parent when they reach an edge.

Use SimpleView to benefit from the prettyUI layout manager without window or panel styling:

local view = prettyui.SimpleView.new(parent, {
    categoryID = "auto",
    x = 12,
    y = 12,
    width = 440,
    height = 260,
    scrollStep = 32,
})

view:AddTitle("Rows")
for index = 1, 12 do
    view:AddTextField({
        placeholder = "Row " .. tostring(index),
    })
end

Scroll to a child

local window = prettyui.Window.new(parent, {
    title = "QuestHelper",
    width = 400,
    height = 300,
})

local questStep = window:AddTitle("Quest Step")

window:ScrollToChild(questStep)

ScrollToChild accepts a direct child returned by an Add… method. It places the child’s top 12 interface units below the viewport top by default and clamps the scroll position at the start or end of the content. Pass a second argument to use a different offset: window:ScrollToChild(questStep, 30).

Construction and configuration

SimpleView.new(parent, options)

categoryID
Optional “auto” allocation for the view’s component tree. See Component IDs.
scrollable
Enables vertical scrolling. Defaults to true.
contentHeight
Optional initial height for raw content. Flow-managed children grow it automatically.
scrollStep
Interface units per wheel delta. Defaults to 32.
x, y, width, height
Viewport position and dimensions.

Methods

content, viewport
The consumer content layer and its clipped viewport.
scrollbarVisible, scrollY, contentHeight, contentWidth
Current overflow state, scroll position, and content dimensions.
SetScrollPosition(y)
Clamped absolute position.
ScrollBy(delta)
Relative movement.
ScrollToChild(child, topOffset)
Scrolls to a direct content child. topOffset defaults to 12.
SetContentHeight(height)
Updates overflow detection, content width, scrollbar visibility, and thumb ratios.
SetScrollable(value)
Enables or disables scrolling and resets to the top when disabled.
SetSize(width, height)
Relayouts viewport and track.
Destroy()
Destroys managed children, tooltips, and the complete view tree.

Deprecated: prettyui.Scrollbar.new(parent, options) now acts as an alias for SimpleView and will be removed in v1.0.0.

Text

Body text uses Museo Sans and titles use Cinzel by default. Pass an id.Font value to override the font.

local heading = window:AddTitle("A Cinzel heading")
local description = window:AddText("Readable body copy")

window:AddText({
    text = "A customized row",
    colour = 0xAFA27FFF,
    marginTop = 12,
})

Constructors

Text.new(parent, options)
Creates body text at an explicit layout, using Museo Sans by default.
Text.title(parent, options)
Creates a title at an explicit layout, using Cinzel by default.
AddText(value)
Appends body text to any flow container. Pass a string or an options table.
AddTitle(value)
Appends a title with automatic section spacing.

Options

text
Displayed string. The entire value may be a string for defaults.
marginTop, marginBottom
Overrides automatic flow spacing.
colour
RGBA colour value.
font
An id.Font value overriding the default body or title font.
shadowed
Set false to disable the default shadow.
maxLines
Maximum visible lines; defaults to 0 (unlimited) for both body text and titles. Set 1 explicitly for a single-line label.
lineSpacing
Distance between line baselines. Omit it or use 0 for the font’s native spacing.
x, y, width, height
Optional layout overrides.

Panel

Panels group content inside other content hosts or act as standalone overlays. Panel content is scrollable by default on both its docked and pop-out surfaces. Set popout = true to let users move a nested panel into a draggable overlay.

local panel = window:AddPanel({
    popout = true,
    resizable = true,
    minWidth = 240,
    minHeight = 120,
    height = 154,
    popoutX = 80,
    popoutY = 80,
    popoutBackgroundAlpha = 0.72,
    popoutClickthrough = false,
    rowBackgroundColours = {
        0x24211EFF,
        0x2E2825FF,
    },
})

panel:AddTitle("Details")
panel:AddText("Window-style automatic content flow")
panel:RefreshRowBackgrounds()
panel:SetPoppedOut(true)

Standalone semi-transparent overlay

A panel does not need to belong to another PrettyUI content host. Construct it directly on the game area without enabling pop-out. Standalone panels can be repositioned by holding Alt and dragging from anywhere on the panel; their position stays within the parent when its dimensions permit.

local gameArea = ui.Interfaces:GetComponent(id.Component.TOPLEVEL_V2__GAME_AREA)

local overlayPanel = prettyui.Panel.new(gameArea, {
    categoryID = "auto",
    width = 300,
    height = 140,
    x = 80,
    y = 80,
    backgroundAlpha = 0.55,
})

overlayPanel:AddTitle("Encounter timer")
overlayPanel:AddText("Next attack: 00:12")

Construction and content

Panel.new(parent, options)

Panel.new(parent, options)
Creates a standalone panel. Hold Alt and drag from anywhere on it to reposition it.
AddPanel(options)
Adds a flow-managed panel to a window, simple view, tab page, or another supported content host.
AddText, AddTitle, Add…
Add content using the same helpers and flow rules as a window.
categoryID
Applies the allocation choice to both surfaces. Inherits from the parent unless set to “auto”. See Component IDs.
scrollable, scrollStep, contentHeight
Configure the shared scroll behavior. scrollable defaults to true.
rowBackgroundColours, rowBackgroundColors
Alternates row background colours to match native settings panels. See Row backgrounds.
rowBackgroundEdgeToEdge
Extends the backgrounds to the content edges. Defaults to false.
SetScrollable(value)
Applies the setting to both docked and pop-out surfaces.
ScrollToChild(child, topOffset)
Scrolls both surfaces to the paired direct child with an optional top offset.
RefreshRowBackgrounds()
Rebuilds row backgrounds on both surfaces after content or layout changes. Call it after adding, removing, or repositioning managed children.
content
Raw content layer for the normal panel surface.
overlayContent
Raw content layer for custom pop-out content.

Pop-out overlay

popout
Enables the pop-out and dock buttons. Defaults to false.
poppedOut
Starts the panel popped out when true.
SetPoppedOut(value)
Switches between the nested panel and overlay.
TogglePopout()
Toggles the current mode.
SetPopoutClickthrough(value)
Makes overlay content ignore input while leaving the dock button available. A resizable click-through pop-out exposes its resize edges only while Alt is held.
SetPopoutBackgroundAlpha(alpha)
Sets overlay background opacity from 0 to 1.
onPopoutChange
Receives the panel and its new popped-out state.
popoutX, popoutY
Initial position of the pop-out in its overlay parent.
popoutWidth, popoutHeight
Optional initial dimensions for the pop-out.

Sizing and movement

resizable
Enables interactive resizing from all four edges and four corners. Defaults to false. Resizing is constrained to the parent where the configured minimum fits.
minWidth, minHeight
Lower bounds used by interactive resizing and SetSize. Defaults to 9 × 9 interface units.
maxWidth, maxHeight
Optional upper bounds used by interactive resizing and SetSize.
SetSize(width, height)
Changes both docked and pop-out dimensions, subject to the configured minimum and maximum dimensions.
onPositionChange
Receives (panel, x, y, poppedOut) once after a completed drag changes position; releasing Alt also ends the drag. Coordinates are parent-relative interface units. Programmatic moves and cancelled drags do not notify. Restore saved positions with x, y for standalone panels or popoutX, popoutY for pop-outs, without position anchors.

Hiding and closing

onClose
Callback receiving the panel, invoked by Close().
destroyOnClose
Makes Close() destroy the panel instead of hiding it.
Hide()
Hides the panel without invoking onClose.
Show()
Shows and raises the panel.
Close()
Invokes onClose, then hides or destroys the panel in accordance with the destroyOnClose setting.

Player interface settings

useNativeTransparency
Makes the panel match the player’s native interface transparency setting. Changes to the native interface transparency setting scale backgroundAlpha and popoutBackgroundAlpha, so both still apply. Defaults to false.
respectInterfaceLock
In Modern UI, prevents moving and resizing while the interface is locked and the player’s PrettyUI lock setting is enabled. Defaults to true.
SetUseNativeTransparency(enabled)
Changes useNativeTransparency. Turning it off restores the panel’s own alpha values.
SetRespectInterfaceLock(enabled)
Changes respectInterfaceLock for this panel in Modern UI.

Content synchronization. Components added with panel Add… helpers stay synchronized between nested and popped-out views. Directly constructed standalone panels use their normal surface and show no toggle unless pop-out is enabled.

Divider

Divider adds a full-width visual separator between flow-managed components.

local divider = window:AddDivider()

local spacedDivider = view:AddDivider({
    marginTop = 12,
    marginBottom = 12,
})

Construction

Divider.new(parent, options)

AddDivider(options)
Adds a flow-managed divider to a window, simple view, panel, or tab page.
Default layout
Spans the available content width and occupies 60 interface units of flow height.

Options and lifecycle

x, width, widthAnchor
Override the default full-width geometry.
marginTop, marginBottom
Adjust vertical spacing.
rowBackground
Defaults to false, so alternating row backgrounds do not paint divider rows. Set to true to include one.
tooltip
Optional tooltip.
Destroy()
Destroys the divider.

Tabbed content

Tabs combines divider-aligned navigation with one switchable content page per tab. Text and icon tabs may be used in the same group.

local tabs = window:AddTabs({
    { text = "Overview" },
    { text = "Items" },
    { kind = "icon", icon = id.Sprite.RS3_ICON_MENU_COMMUNITY, tooltip = "Actions" },
}, {
    height = 180,
    activeIndex = 1,
    onChange = function(group, index, value, page)
        log("Selected tab " .. tostring(index))
    end,
})

local overview = tabs:GetPage(1):AddPanel({ height = 96 })
overview:AddText("Overview content")
tabs:GetPage(2):AddItemGrid(items, { columns = 4, rows = 2 })
tabs:SetActive(2)

Configuration

Tabs.new(parent, tabs, options)

Text tabs
Use { text = “Label” }.
Icon tabs
Use { kind = “icon”, icon = spriteID, tooltip = value }.
Disabled tabs
Set disabled = true on a tab entry.
activeIndex
Initial selected tab; defaults to 1.
onChange(group, index, value, page)
Runs when the active tab changes.
tabGap, tabInset
Adjust horizontal spacing and the first tab’s inset.
scrollable, scrollStep, contentHeight
Configure scrolling for every tab page. Pages scroll by default and hide their scrollbar until overflow.
rowBackgroundColours, rowBackgroundColors
Alternates row background colours to match native settings panels. See Row backgrounds.
rowBackgroundEdgeToEdge
Extends the backgrounds to the content edges. Defaults to false.
Per-page row backgrounds
Set either row-background option on a tab entry to override it for that page.
Per-tab scrolling
A tab entry may override scrollable or contentHeight for its own page.

Pages and control

GetPage(index)
Returns a page with content and the standard Add… helpers, including AddPanel for flow-managed, non-popout panels and AddTabs for nested tab groups.
Tab page scroll methods
Pages expose SetScrollable, SetScrollPosition, ScrollBy, ScrollToChild, and SetContentHeight.
page:RefreshRowBackgrounds()
Rebuilds backgrounds after adding, removing, or moving rows.
SetActive(index, notify)
Shows one enabled page and optionally invokes onChange.
GetActiveIndex()
Returns the selected one-based index.
SetScrollable(value)
Enables or disables scrolling across every page.
GetTab(index)
Returns the normalized tab state.
SetDisabled(index, disabled)
Changes availability and selects another enabled tab when necessary.
SetTabTooltip(index, value)
Adds, replaces, or removes one tab’s tooltip.
Destroy()
Destroys the tab group and its pages.

Collapse button

An expandable header with an indented content region that reflows following components.

CollapseButton.new(parent, text, options)

local section = window:AddCollapseButton("Actions", {
    expanded = false,
    resizeParent = true,
    onToggle = function(self, expanded)
        log(expanded and "Opened" or "Closed")
    end,
})

section:AddText("Choose an action below.")
section:AddSimpleButton("Short", firstAction)
section:AddSimpleButton("A much longer action", secondAction)

Options

expanded
Sets the initial open state.
resizeParent
Fits the immediate PrettyUI content host vertically as the section is populated, opened, or closed. Defaults to false, preserving the host’s fixed size and scrolling. Width is unchanged.
disabled
Blocks interaction when true.
indent
Controls the content inset.
onToggle(section, expanded)
Runs after the open state changes and any parent resizing completes.
colour, disabledColour, hoverCursor, shadowed, tooltip
Customize presentation and interaction.

Content and control

Add… methods
Add… methods can be used to add any simple control to a section.
Button widths
Textual buttons in one section equalize to the widest button.
SetExpanded(expanded)
Opens or closes the content, reflows following items, and fits the parent when resizeParent is enabled.
Toggle()
Switches the open state.
SetDisabled, SetHoverCursor, SetText
Update the header at runtime.

Parent resizing

With resizeParent = true, fitting includes all measured content in the immediate host, layout padding, and its borders/title bar. It removes unused vertical space rather than preserving the original height. Initially expanded sections also fit as their content is added.

  • Windows respect minHeight (140 by default) and maxHeight. Content exceeding the maximum remains scrollable when scrolling is enabled.
  • Panels resize both docked and pop-out surfaces, keeping the section’s open state synchronized.
  • Simple views resize their viewport.
  • Tab pages resize their tab container and reflow its following siblings, without resizing ancestor windows or panels.

Use the host’s AddCollapseButton helper so the section is bound to its content layout. A directly constructed CollapseButton.new without a flow owner does not resize its raw native parent.

Simple button

A compact action or toggle button containing text or an icon.

SimpleButton.new(parent, content, action, options)

local iconButton = window:AddSimpleButton(id.Sprite.CHAT_V2_FILTERS_ON_8, function()
    openIconAction()
end)

local textButton = window:AddSimpleButton("Test", function(self, active)
    setTestEnabled(active)
end, { inline = true, toggleable = true })

Content and options

Text
Pass a string; the button sizes itself to fit.
Icon
Pass a numeric sprite ID.
Options
width, height, size, iconSize, iconWidth, iconHeight, colour, disabledColour, hoverCursor, and tooltip customize the button.

States and methods

toggleable
Persists the active state after a click.
disabled
Sets the initial disabled state and blocks input.
SetActive(active)
Changes the persistent active state.
SetDisabled(disabled)
Changes availability.
SetHoverCursor(cursor)
Overrides the hover cursor.
Destroy()
Destroys the button.

Fancy button

A prominent text button available in positive, neutral, and negative variants.

FancyButton.new(parent, text, action, options)

local confirm = window:AddFancyButton("Confirm", function()
    confirmAction()
end, { variant = "positive" })

local cancel = window:AddFancyButton("Cancel", function()
    cancelAction()
end, { inline = true, variant = "negative" })

Options

variant
Accepts positive, neutral (default), or negative.
width
Requests a minimum width; otherwise the button fits its label.
colour, disabledColour
Override the variant’s text colours.
disabled, hoverCursor, tooltip
Configure initial availability and interaction.

Methods

SetVariant(variant)
Changes the variant and default text colour.
SetDisabled(disabled)
Changes availability.
SetText(text)
Changes the label and recalculates the fitted width.
SetHoverCursor(cursor)
Overrides the hover cursor.
Destroy()
Destroys the button.

Sprite button

Named sprite buttons support momentary actions and enabled/disabled toggles.

SpriteButton.new(parent, spriteName, action, options)

local actionButton = window:AddSpriteButton("MENU", function()
    openMenu()
end)

local toggleButton = window:AddSpriteButton("SETTINGS", function(self, enabled)
    setSettingsEnabled(enabled)
end, { inline = true, toggleable = true })

local lockButton = window:AddSpriteButton("LOCK", function(self, unlocked)
    setLocked(not unlocked)
end, { inline = true, toggleable = true, disabled = true })

local trashButton = window:AddSpriteButton("TRASH", function()
    deleteSelectedItem()
end, { inline = true, tooltip = "Delete" })

Modes

Action
Runs the callback when clicked.
Toggle
Set toggleable = true; each click changes the enabled state and passes it to the callback.
disabled
Sets the initial disabled state. Non-toggle buttons ignore input while disabled.
hoverCursor
Overrides the sprite set’s default cursor.

Methods

SetDisabled(disabled)
Updates the enabled state.
SetSprite(name)
Switches to another predefined sprite set.
SetHoverCursor(cursor)
Applies a Cursor config or numeric ID.
Destroy()
Destroys the button.

The name palette below shows each button’s neutral client sprite. Filter by name, then select a tile to copy its SpriteButton name.

Text fields, combo boxes and lists

These controls provide text entry and single- or multi-selection with consistent flow placement, tooltips, disabled states, and callbacks.

For keyboard bindings, use KeybindField.

TextField.new(parent, options)
ComboBox.new(parent, options)
List.new(parent, options)

local name = window:AddTextField({
    placeholder = "Character name",
    maxLength = 24,
    onSubmit = function(field, text)
        saveName(text)
    end,
})

local skill = window:AddComboBox({
    entries = {
        { label = "Attack", id = 1 },
        { label = "Magic", id = 2 },
    },
    selectedID = 1,
    onChange = function(combo, id, label)
        selectSkill(id)
    end,
})

local filters = window:AddList({
    maxSelected = 2,
    entries = {
        { label = "Timers", id = 1, selected = true },
        {
            label = "Icons",
            id = 2,
            backgroundColour = 0x211E1BFF,
            hoverColour = 0x332C27FF,
            selectedColour = 0x4A3D32FF,
            textColour = 0xF4E7D0FF,
        },
    },
    onChange = function(list, id, selected)
        setFilter(id, selected)
    end,
})

TextField

text, placeholder
Initial and empty-state text.
visibility, filterMode, maxLength, inputMode
Configure native input and validation behavior. maxLength defaults to 9999.
onChange(field, reason, text)
Runs when content changes.
onSubmit(field, text)
Runs when Enter submits the field.
GetText(), SetText(text, notify?)
Read or replace the content.

ComboBox and List

entries
An array of labels or { label, id } records. IDs must be unique.
Ordered combo boxes
Give an entry an integer order to use the searchable ordered combo box. Entries with order appear first, sorted by order and then label; entries without order follow alphabetically. Supply ordered entries at construction. An open dropdown closes when its field is partially or fully clipped by a scrolling container. Scrolling the field back into view does not reopen it.
selectedID
Selects the initial combo-box entry.
maxSelected
Limits active list entries.
Entry options
selected, disabled, visible, and icon configure individual entries. List entries also accept backgroundColour, hoverColour, selectedColour, textColour, and disabledTextColour overrides. Selected backgrounds take precedence over hover and base backgrounds.
Callbacks
Combo boxes report (control, id, label, eventType); lists report (control, id, selected, eventType).
Methods
Use Select, SetSelected, SetScrollPosition, SetEntries, Clear, and SetDisabled to update controls.

Container helpers. AddTextField, AddComboBox, and AddList are available on windows, simple views, panels, tab pages, and collapse sections. They fill the content width by default. Pop-out panels synchronize field values and selections between views.

Radio and checkbox buttons

Radio groups select one value; checkbox groups retain an ordered set of values.

RadioButton.new(parent, choices, options)
CheckboxButton.new(parent, choices, options)

local density = window:AddRadioButton({
    { text = "Compact", value = "compact" },
    { text = "Comfortable", value = "comfortable" },
}, {
    selectedValue = "comfortable",
    onChange = function(group, value)
        applyDensity(value)
    end,
})

local features = window:AddCheckboxButton({
    { text = "Audio", value = "audio", selected = true },
    { text = "Animations", value = "animations" },
}, {
    onChange = function(group, values, changedValue, selected)
        saveFeatures(values)
    end,
})

local selectedDensity = density:GetSelectedValue()
local selectedFeatures = features:GetSelectedValues()

Choices and state

choices
A non-empty array. Each entry may be a direct value or a table with text/label, value, selected, disabled, and tooltip.
selectedValue
Initial value for a radio group.
selectedValues
Initial array or value-to-true map for a checkbox group.
inline
Lays radio or checkbox choices out side by side on one row. It also retains the shared flow behavior and joins the current content row when one exists.
maxLines
The most lines a choice’s label may wrap onto. Defaults to 1. Use 0 for no limit. Labels are truncated with elipses after maxLines. Ignored if inLine is set.
disabled
Disables the entire group.
onChange
Receives the updated selection after user changes.

Methods

GetSelectedValue()
Reads the radio value.
SetSelectedValue(value)
Selects one radio value, or clears it with nil.
GetSelectedValues()
Returns checkbox values in option order.
IsSelected(value)
Tests a radio or checkbox value.
SetSelected(value, selected)
Updates one checkbox value.
SetDisabled(disabled)
Changes group availability.
SetOptionTooltip(value, tooltip)
Adds, replaces, or removes one choice’s tooltip.

Slider

A ranged control supporting thumb dragging, track clicks, and decrease/increase buttons.

local opacity = window:AddSlider({
    min = 0,
    max = 100,
    value = 100,
    step = 1,
    onChange = function(_, value)
        window.background.alpha = value / 100
    end,
})

Configuration

Slider.new(parent, options)

min, max
Numeric range, defaulting to 0 through 100.
value
Initial value; defaults to the minimum.
step
Positive increment and snapping interval; defaults to 1.
buttonGap
Space between the track and each button; defaults to 4.
onChange(slider, value)
Runs after an interactive or notified programmatic change.
disabled
Blocks interaction when true.

Methods and interaction

GetValue()
Returns the current snapped value.
SetValue(value, notify?)
Clamps and snaps a value. Pass false to suppress the callback.
SetDisabled(value)
Changes availability.
Refresh()
Updates the position of the marker based on the slider’s current width.
AddSlider(options)
Adds a width-filling slider to supported containers.

Colour picker

A button with a colour swatch that opens a picker window beside the swatch. Changes remain provisional until the user accepts them; closing the window cancels the selection.

local picker = window:AddColourPicker({
    value = 0xC86B17FF,
    buttonSize = 48,
    windowTitle = "Highlight colour",
    tooltip = "Choose a highlight colour",
    onChange = function(_, colour)
        settings.highlightColour = colour
    end,
})

picker:SetValue(0x8A2BE2FF, false)
local colour = picker:GetValue()

Enable alphaSlider when callers need to choose opacity as well as colour:

local overlayPicker = window:AddColourPicker({
    value = 0x4D8BD566,
    alphaSlider = true,
    windowTitle = "Overlay colour",
    onChange = function(_, colour)
        settings.overlayColour = colour
    end,
})

Construction and appearance

ColourPicker.new(parent, options)

value
Initial colour value.
alphaSlider
Adds an opacity slider when true. The accepted value includes the selected alpha in its final AA byte.
buttonSize or size
Sets the square button size; defaults to 24. The colour swatch occupies 65% of the shorter button edge.
width, height
Override the button dimensions independently.
tooltip, disabled
Configure the button tooltip and initial availability.
AddColourPicker(options)
Adds a flow-managed picker to a window, simple view, panel, or tab page.

Picker window

windowTitle or title
Changes the picker window title.
windowWidth, windowHeight
Override picker dimensions. The minimum and default size is 220 × 340. alphaSlider raises the minimum and default height to 376.
windowParent, overlayParent
Select the parent that contains the picker window. overlayParent is an alias. Without either option, the window is mounted in the outermost parent.
windowX, windowY, pickerX, pickerY
Override either position axis. pickerX and pickerY are aliases. Without an override, the picker aligns horizontally with its swatch, opens below it, flips above it when necessary, and keeps automatic coordinates within its window parent. Explicit coordinates are not clamped.
acceptText, acceptWidth, acceptVariant
Configure the accept button.
Accept and cancel
Dragging updates the preview. Accept commits the colour and runs onChange; the window close button discards the provisional colour.

State

GetValue()
Returns the committed colour. GetColour() is an alias.
SetValue(colour, notify?)
Sets the committed colour and updates the swatch. Pass false to suppress onChange. SetColour() is an alias.
Open()
Opens or raises the picker and returns true, or false while the control is disabled.
Close()
Closes the picker without committing its provisional colour.
SetDisabled(disabled)
Changes button availability.
Destroy()
Closes the picker and destroys its component tree.

Mouseover tooltips

Tooltip-enabled PrettyUI controllers accept a string or options table through their tooltip option and expose SetTooltip(value) for later changes. Mouseover tooltips appear immediately in 11-point Museo Sans, including on dock tabs. They are built on demand and cleaned up when hidden.

local button = prettyui.SpriteButton.new(
    window.content,
    "SETTINGS",
    openSettings,
    { tooltip = "Open settings" }
)

button:SetTooltip("Settings are unavailable")
button:SetTooltip({ text = "Try again later", maxWidth = 180 })
button:SetTooltip(nil)

local attachment = prettyui.Tooltip.attach(
    anotherComponent,
    itsParent,
    { text = "More information", maxWidth = 180 }
)

attachment:SetText("Updated information")

Automatic

tooltip = "text"
Measures the content, chooses a side with enough room, and stays within its overlay parent.
tooltip = options
Customizes text, maximum width, dimensions, position, or overlay parent.
placement, placementFallback
placement prefers "above", "below", "left", or "right" (the default). Set placementFallback = false to keep that side instead of trying another when space is limited. The result still stays within the overlay parent unless constrainToParent = false.
Overlay
Inherits the owning window’s top-level coordinate space, so tooltips render above windows without scroll viewport clipping.
SetTooltip(value)
Adds, updates, or removes a controller’s tooltip.

Attachment

Show()
Builds (when needed), positions, raises, and displays the tooltip.
Hide()
Hides the tooltip and frees its components.
SetText(text)
Updates, remeasures, and repositions the attachment in place. Returns false after destruction.
Destroy()
Removes hooks and destroys its component tree.

Item slot

ItemSlot displays an Obj config and optional quantity in a slot similar to that in the beasts tab.

local emptySlot = view:AddItemSlot(nil)

local slot = view:AddItemSlot(config.Obj.EGWD_JAS_BOSS_MAGIC_WEAPON_NEW, {
    inline = true,
    tooltip = "Magic weapon",
})

slot:SetObject(config.Obj.STEEL_BAR)
slot:SetDisabled(true)

Construction

ItemSlot.new(parent, object, options)

object
Obj config to display, or nil for an empty slot.
AddItemSlot(object, options)
Adds a flow-managed slot to a window, simple view, or panel.
quantity
Optional stack size; values above one are displayed by default.
tooltip
Tooltip shown while the slot contains an object.
disabled
Starts the slot disabled. Populated slots dim the item and show a dark overlay; empty slots show no overlay.

Appearance and methods

itemInset
Inset around the object; defaults to 4.
outlineWidth
Optional object outline thickness.
shadowRGBA
Optional object shadow colour.
quantityMode
Overrides the quantity display mode.
SetObject(object, quantity)
Replaces the Obj and optional stack size; pass nil to clear it.
SetQuantity(quantity)
Changes or clears the stack size.
SetDisabled(disabled)
Toggles the disabled appearance. This is visual only; the object, quantity, and tooltip remain unchanged.
SetTooltip(value)
Changes the tooltip.
Destroy()
Destroys the slot.

Item grid

ItemGrid arranges item slots into configurable rows and columns, with optional tooltips and drag-and-drop. With an inventory-like visual style.

local weapon = config.Obj.EGWD_JAS_BOSS_MAGIC_WEAPON_NEW

local grid = view:AddItemGrid({
    [1] = weapon,
    [2] = config.Obj.STEEL_BAR,
    [4] = { object = config.Obj.BRONZE_ARROW, quantity = 250 },
    [6] = config.Obj.LOGS,
    [10] = config.Obj.PLATINUM_BRACELET,
    [16] = weapon,
}, {
    columns = 4,
    rows = 4,
    tooltip = true,
    dragDrop = true,
})

grid:SetObjectAt(2, 2, weapon)
grid:SetObject(1, nil)

Construction and data

ItemGrid.new(parent, objects, options)

objects
A sparse row-major array of Obj configs or { object, quantity, tooltip } entries.
columns, rows
Grid dimensions; each defaults to 1.
slotGap
Distance between cells; defaults to 2.
quantityMode
Quantity display mode for grid cells.
dragDrop
Enables dragging between cells.
onDrop
Receives the grid, source and destination indices, moved object, and displaced object.
tooltip
Use true for object names, a shared value, or a function receiving the object, index, row, and column.

Methods and behavior

GetSlot(index)
Returns the ItemSlot at a row-major index.
SetObject(index, object, tooltip, quantity)
Updates one cell; pass nil to empty it.
SetObjectAt(column, row, object, tooltip, quantity)
Updates one cell by coordinates.
SetObjects(objects)
Replaces all cell contents.
SetTooltip(value)
Changes the default tooltip value or resolver and refreshes every cell. Explicit per-entry tooltips still take precedence.
MoveObject(source, destination, notify)
Moves or swaps entries while preserving quantities and tooltips.
SetDragDropEnabled(enabled)
Changes drag-and-drop availability.
Empty cells
Remain valid drop targets but do not show tooltips.
Destroy()
Destroys the grid and its slots.

Loading spinner

Animated loading indicator with controllable speed and playback.

local spinner = window:AddSpinner({
    degreesPerLogicUpdate = -6,
})

spinner:SetDegreesPerLogicUpdate(-4)
spinner:SetRotation(180)
spinner:Stop()
spinner:Start()
spinner:Reset()
spinner:Destroy()

Spinner

Spinner.new(parent, options)

size
Defaults to 72.
rotation
Initial foreground angle in degrees.
degreesPerLogicUpdate
Foreground rotation added per logic update; defaults to -6. Positive values reverse the default direction.
BigSpinner, AddBigSpinner(options)
Aliases for Spinner and AddSpinner(options).
SetRotation(degrees)
Sets and normalizes the foreground angle.
SetDegreesPerLogicUpdate(degrees)
Changes rotation speed and direction. The former logicUpdatesPerFrame option and SetFrame() and SetLogicUpdatesPerFrame() methods are unavailable.

Lifecycle

autoPlay
Set false to construct the spinner paused.
Start()
Starts or resumes playback.
Stop()
Pauses playback.
Reset()
Restores the angle to zero.
Destroy()
Unsubscribes and destroys the component.

Anchored tooltips

An examine-style tooltip that follows an NPC, world location, projected position, or custom screen-space anchor.

local npcTooltip = prettyui.AnchoredTooltip.forNPC(npc, {
    text = "An NPC tooltip",
})

npcTooltip:SetText("Updated NPC tooltip")

local locTooltip = prettyui.AnchoredTooltip.forLoc(coordGrid, {
    text = "A location tooltip",
    heightAboveGround = 512,
})

local richTooltip = prettyui.AnchoredTooltip.forNPC(npc, {
    width = 240,
    height = 64,
    buildContent = function(tooltip, content)
        local icon = ui.Sprite.new(content)
        icon:SetSize(21, 21)
        icon.spriteID = id.Sprite.RS3_ICON_INFO_21PX_2

        local timer = ui.Text.new(content)
        timer:SetPos(29, 0)
        timer:SetSize(-29, 28, 1.0)
        timer.content = "00:30"
        timer.rgba = 0xF1C384FF
        return { icon = icon, timer = timer }
    end,
})

richTooltip.contentResult.timer.content = "00:29"

Anchors

forNPC(npc, options)
Tracks a live NPCEntity and destroys itself when that entity becomes invalid.
forLoc(loc, options)
Tracks a CoordGrid or CoordFine.
show(options)
Accepts npc, loc, a world position (Vector3), or an anchor callback returning a screen Vector2.
new(parent, options)
Uses an explicit overlay parent.

Content and lifecycle

text
Simple text content.
buildContent(tooltip, content)
Builds custom content; its return value is available as contentResult.
content
Exposed layer for adding or updating components.
width, height, contentWidth, contentHeight
Configure total or inner dimensions.
padding, paddingX, paddingY
Configure the content inset.
heightAboveGround, offsetX, offsetY
Control world and screen-space offsets.
backgroundColour, backgroundAlpha
Configure the background.
SetText(text)
Updates the tooltip text and resizes it if necessary.
Update(), Show(), Hide(), Destroy()
Refresh, control, or remove the tooltip.

Achievement popup

A convincing recreation of the collection log and achievement popup.

local popup = prettyui.AchievementPopup.show({
    title = "FREE PARTYHAT!",
    text = "You found yourself a free yellow partyhat. Congratulations!",
    item = config.Obj.YELLOW_PARTYHAT,
})

local textOnly = prettyui.AchievementPopup.show({
    title = "NO PARTYHAT",
    text = "No item slot is rendered",
})

Construction

AchievementPopup.show(options)
Shows a top-centred popup and returns it, or nil while the game area is unavailable.
AchievementPopup.new(parent, options)
Uses an explicit parent.
title, text
Set the heading and body.
item, quantity
Optionally display an Obj config and stack quantity.

Presentation and lifecycle

Timing
The popup reveals, remains visible, then fades over four seconds.
sound, soundID
Disable or replace the completion sound.
Position
Defaults to a 300x92 top-centred overlay. Override parent, x, y, xAnchor, or yAnchor.
Destroy()
Dismisses the popup early.

Buff and debuff bars

Add custom buffs and debuffs to the native buffbars.

local buff = prettyui.BuffBar.addBuff({
    objId = config.Obj.COINS_10000,
    label = "187k",
    borderRgba = 0xFFD700FF,
    backgroundRgba = 0x2B2100CC,
    tooltip = "Stored coins",
})

local debuff = prettyui.BuffBar.addDebuff({
    objId = config.Obj.BRONZE_ARROW,
    duration = 45,
    tooltip = "Temporary debuff",
})

buff:SetLabel("188k")
buff:SetTooltip("Stored coins: 188k")
buff:SetObject(config.Obj.PLATINUM_BAR)
buff:SetSprite(id.Sprite.RS3_ICON_INFO_21PX_2)
prettyui.BuffBar.removeBuff(buff)

API

BuffBar.addBuff(options)
BuffBar.addDebuff(options)
BuffBar.removeBuff(handle)
BuffBar.removeDebuff(handle)

addBuff(options), addDebuff(options)
Return a handle, or nil for an invalid duration or unavailable native bar.
removeBuff(handle), removeDebuff(handle)
Destroy an entry. Return false for expired, removed, or wrong-bar handles.

Options

objId, spriteID
Object inventory artwork or a static sprite. objId takes precedence.
label, labelRgba, font
Untimed label and styling. Defaults are empty, white, and id.Font.NOTOSANS_BOLD_12.
backgroundRgba
Inset background colour. Defaults to transparent.
borderRgba
Buff border colour. Only buffs can have custom border colours, debuffs use the default red.
tooltip, visible
Standard tooltip value and initial visibility. Visibility defaults to true. Buff and debuff tooltips appear after after a brief delay to match the native buff behavior.
duration
Positive lifetime in seconds.

Handle

SetLabel(text, rgba?)
Updates an untimed label. Returns false for timed or removed entries.
SetObject(objId)
Switches to object inventory item sprite. Accepts an object ID, an Obj config, or nil to clear the icon.
SetSprite(spriteID)
Switches to a raw sprite ID. Pass nil to clear the icon.
SetTooltip(value)
Adds, replaces, or removes the entry tooltip. Pass nil to remove it. Returns false after removal.
SetVisible(visible)
Shows or hides the entry and updates layout. Returns false after removal; timers continue while hidden.
Lifecycle
Remove untimed entries with the matching method. PrettyUI clears remaining entries on shutdown.

Overhead bars

This API is Unreleased.

Overhead bars are available in the PrettyUI Git repository, but not yet in the public mod.io distribution.

prettyui.OverheadBar attaches a health-bar-like overlay to NPCs, players, or Locs.

OverheadBar.forNPC(npcEntity, options?)
OverheadBar.forPlayer(playerEntity, options?)
OverheadBar.forLoc(locEntity, options?)

Constructors need an entity and return nil if the target or overlay is unavailable.

Styles and fill

variant
Style name from prettyui.OverheadBar.Variants (default "health.default").
value
Fill fraction, default 1. SetValue(value) clamps it to 0..1.
SetVariant(name)
Switches style without changing the fill; returns false for an unknown style or destroyed bar.

Placement options

heightAboveGround
World-space height override. NPCs use their configured overlay height or current bounding-box top; players default to 1024, Locs to 512.
offsetX, offsetY
Pixel offsets, default 0 and 8 respectively. Positive offsetY moves the bar up.
parent
Optional overlay component.
hidden
Start hidden when true.

Lifecycle

Update()
Reprojects the bar; automatic each logic tick. Returns false when hidden or offscreen.
Show(), Hide()
Control visibility. Show() also updates the position.
Destroy()
Removes the bar. It also self-destructs when its entity or overlay disappears.

Row backgrounds

Row backgrounds mimic the alternating colours used by native settings panels. They are available on windows, panels, and tab pages.

local window = prettyui.Window.new(parent, {
    width = 420,
    height = 300,
    rowBackgroundColours = {
        0x24211EFF,
        0x2E2825FF,
    },
})

local group = "display"
window:AddTitle({
    text = "Display",
    rowBackgroundGroup = group,
})
window:AddText({
    text = "Configure the interface below.",
    rowBackgroundGroup = group,
})
window:AddCheckboxButton({
    { text = "Show labels", value = "labels" },
}, {
    rowBackgroundGroup = group,
})

window:AddTitle("Notifications")
window:RefreshRowBackgrounds()

Configuration

rowBackgroundColours, rowBackgroundColors
Colours applied in order and repeated as needed. Each flow row receives one background by default. Inline components on the same row share it.
rowBackgroundGroup
Consecutive rows with the same value share one background. The colour sequence advances once for the group. Reusing the value after another group starts a new background.
rowBackground
Set to false on a managed component to leave its flow row unpainted. An excluded row also separates matching rowBackgroundGroup regions, so a group never paints across excluded content. If included and excluded components share one inline row, the row remains painted.
rowBackgroundEdgeToEdge
Extends backgrounds through layout padding and gaps to the content edges. Defaults to false.
Absolute children
Components using absolute = true or an explicit y are ignored.

Hosts and refresh

Window.new(parent, options)
Accepts the row-background configuration options.
Panel.new(parent, options)
Accepts the options and applies backgrounds to docked and pop-out content.
Tabs.new(parent, tabs, options)
Applies the options to every page. A tab entry may override them for its page.
RefreshRowBackgrounds()
Rebuilds backgrounds after adding, removing, moving, or resizing rows. Adding a slider refreshes configured backgrounds automatically; call this after other layout changes. Call it on the window, panel, or tab page that owns the rows.

Graphs

Graphs display data supplied by your plugin. They can be hosted in a windows, simple views, tab pages, or panels.

Time graph

Rolling interval totals mimicking the runemetrics graphs.

local bus = prettyui.TimeGraph.CreateEventBus()
local graph = window:AddTimeGraph({
    metric = { id = "xp", label = "XP", rgba = 0x69B7FFFF },
    interval = 5,
    capacity = 60,
    bus = bus,
})

bus.Update.Publish({ metric = "xp", value = 125 })
bus.Update.Publish({ metric = "xp", value = 75 })

Options

metric
Descriptor with a nonempty string id, optional label (defaults to id), spriteID (icon instead of title), and rgba (positive bar colour).
interval, capacity
Seconds per bucket (5) and retained bucket count (60), including the live bucket.
zoom, zoomable, onZoom
Initial magnification (1), wheel zoom (true), and function(graph, zoom).
bus
Shared update bus. Defaults to a new bus available as graph.bus.

Updates and controls

bus.Update.Publish({ metric, value })
Adds a signed delta to the current bucket. Returns true or false, error. Subscribe(callback) and Unsubscribe(callback) also use dot syntax.
SetZoom(zoom, notify?), GetZoom(), ZoomIn(), ZoomOut()
Changes magnification. Pass false to SetZoom to suppress onZoom.
GetSnapshot()
Returns { metric, interval, capacity, total, elapsedSeconds, buckets }. Metric is the ID; chronological buckets contain { value, startSeconds, endSeconds, complete }. The last bucket is live.

Bar chart

Compare categories in caller order.

local chart = window:AddBarChart({
    label = "XP by skill",
    data = {
        { id = "attack", label = "Attack", value = 250 },
        { id = "construction", label = "Construction", value = 175 },
    },
})

chart:SetData({
    { id = "attack", label = "Attack", value = 375 },
    { id = "construction", label = "Construction", value = 250 },
})

Options

label, data
Heading and { id, label, value, rgba? } rows. Row colour overrides chart colour.
orientation, rgba
“horizontal” (default) or “vertical”. Chart colour overrides source colours.

Methods

SetData(rows)
Replaces category data.
GetSnapshot()
Returns { label, data }, including resolved row colours.

Histogram

Group numeric samples into contiguous bins.

local histogram = window:AddHistogram({
    label = "Duration (seconds)",
    binWidth = 5,
    samples = { 73.2, 74.4, 75.6, 81 },
})

histogram:SetSamples({ 73.2, 74.4, 75.6, 78.6, 81 })

-- Or send pre-binned counts.
histogram:SetBins({
    { lower = 70, upper = 75, count = 2 },
    { lower = 75, upper = 80, count = 2 },
    { lower = 80, upper = 85, count = 1 },
})

Options

label, rgba
Heading and bar colour.
samples, binWidth, origin
Sample values, bin width (5), and alignment origin (0). Bins use [lower, upper).

Methods

SetSamples(samples)
Replaces samples and rebuilds bins.
SetBins(bins)
Replaces the distribution with contiguous { lower, upper, count } bins.
GetSnapshot()
Returns { label, binWidth, origin, sampleCount, bins }.

Shared API

Standalone constructors use prettyui.TimeGraph.new(parent, options), prettyui.BarChart.new(parent, options), or prettyui.Histogram.new(parent, options). Default size is 480 × 260; managed helpers fill the host width. Standard anchors and flow options apply.

Reset()
Clears data and totals while retaining configuration and zoom.
SetSize(width, height), SetVisible(visible)
Resize or hide the graph. Size anchors are retained; hidden time graphs continue collecting.
Destroy()
Removes UI and subscriptions. Managed hosts clean up automatically; standalone owners must call it.

Snapshots are detached copies. Panel dock/popout views stay synchronized.

Sprite

Add an image from a built-in sprite ID or a loaded Plugin.resources image.

prettyui.Sprite.new(parent, sprite, options)
host:AddSprite(sprite, options)

Managed images

AddSprite is available on Window, SimpleView, TabPage, and Panel. Panels return a paired handle that updates both their docked and popped-out sprites.

local icon = window:AddSprite(id.Sprite.RS3_BTN_MENU_7_2, {
    size = 24,
    tooltip = "Decorative menu icon",
})
window:AddText({ text = "Menu", inline = true })

-- Put myimage.png in this plugin's resources/ directory.
local portrait = window:AddSprite(Plugin.resources.myimage, {
    size = 64,
    marginTop = 12,
    tooltip = "Image description",
})
window:AddText({ text = "Image", inline = true, offsetY = 20 })

The 128×128 myimage.png resource is displayed at 64×64 here. Pass the loaded image value, not "myimage", "myimage.png", or a filesystem path. Sprite does not load files, infer intrinsic dimensions, or provide aspect-fit sizing; choose dimensions with the desired aspect ratio.

Managed sprites reserve their configured width and height without filling the row. inline = true joins the current row, allowing sprites and text to sit beside one another. See shared component options and layout and scale for margins, spacing, anchors, and absolute placement.

Standalone image

-- parent is an existing native UI component.
local image = prettyui.Sprite.new(parent, Plugin.resources.myimage, {
    x = 16,
    y = 16,
    width = 128,
    height = 128,
})

-- When this standalone image is no longer needed:
image:Destroy()

The constructor positions the image directly under parent; it does not register a managed flow row. Use AddSprite when the host should manage placement and cleanup.

Size and presentation

size
Sets both dimensions; defaults to 24 interface units.
width, height
Override size independently. For example, { size = 64, width = 96 } produces a 96×64 image.
prettyui.Sprite.getSize(options)
Returns width, height using those same defaults and overrides, without creating an image or inspecting its resource.
x, y, xAnchor, yAnchor
Position offsets and parent-relative anchors. Standalone defaults are zero; managed hosts supply flow positions. Explicit y or absolute = true opts a managed sprite out of flow.
widthAnchor, heightAnchor
Parent-relative size anchors, both defaulting to zero.
colour or color
RGBA tint, defaulting to 0xFFFFFFFF (white). colour takes precedence if both are supplied.
alpha
Optional native sprite opacity override.
tooltip
A string or tooltip options table. Without a tooltip, the sprite is clickthrough. Attaching a tooltip uses the existing hover handling; removing it restores clickthrough. No click action is added.

Methods and lifecycle

SetSprite(sprite)
Replaces the built-in sprite ID or loaded image without changing dimensions or flow placement.
SetTooltip(value)
Adds or updates a tooltip; pass nil to remove it.
Destroy()
Removes the tooltip and destroys the native sprite. For a managed sprite, also removes its layout entry and reflows following content.
Host cleanup
Destroying a managed host destroys its sprites and their tooltips. Panel handle methods apply to both paired images. For standalone images, call Destroy() when finished to release tooltip hooks as well as the image.

Dialog

A centred window with custom content and footer actions. Dialogs stack separately for each parent component.

Dialog.new(parent, options)

Options

title
Window title. Defaults to an empty string.
width, height
Defaults to 328 × 150. Width grows when needed to fit the footer actions.
modal
Defaults to true. Dims the parent and blocks interaction behind the dialog.
content(window)
Called once to populate the underlying Window using its Add… methods.
actions
Array of footer actions, ordered left to right. Defaults to no actions.
onDismiss()
Called by the window close button, not by footer actions or Destroy(). Its return value does not prevent closing.
hideCloseButton
Allows a dialog to be created without a Close Button. Ensure you provide an alternative way to close the dialog Close() will work.

Actions

label
Button text.
variant
neutral (default), positive, or negative.
disabled, tooltip
Initial disabled state and tooltip.
onClick()
Return true to close the dialog; any other return keeps it open. Omitting the callback closes it immediately when clicked.

Methods and fields

window
Underlying Window controller.
Destroy()
Removes the dialog from its stack and destroys its window without invoking callbacks.
Dialog.depth(parent)
Returns the number of open dialogs for the parent.
Dialog.dismissAll(parent)
Destroys all dialogs for the parent without invoking callbacks.
Dialog.Shutdown()
Destroys all dialogs. Called automatically when PrettyUI shuts down.

Confirm

A Dialog with body text and cancel/confirm buttons. Returns a Dialog controller with the same fields and methods.

Confirm.new(parent, options)

Options

title
Defaults to CONFIRM.
body
Body text. Defaults to an empty string.
width, height, modal
Same as Dialog, including defaults and automatic footer sizing.
cancelLabel, confirmLabel
Defaults to CANCEL and CONFIRM.
confirmVariant
positive (default), neutral, or negative. The cancel button uses neutral.

Callbacks

onConfirm()
Called by the confirm button. Return false to keep the dialog open; any other return closes it. Without a callback, the button closes it.
onCancel()
Called by the cancel button with the same return rules as onConfirm. Also called by the window close button, which closes regardless of the return value.

Destroy() and Dialog.dismissAll(parent) do not invoke either callback.

Keybind field

An input-styled field for one key or a two-key chord, displayed as centered text.

KeybindField.new(parent, options)
host:AddKeybindField(options)

local binding = { GameKey.CONTROL, GameKey.SHIFT }
local field = window:AddKeybindField({
    value = binding,
    defaultValue = binding,
    onChange = function(field, value)
        binding = value
    end,
})

-- In your input handler or update loop:
local held = prettyui.KeybindField.IsDown(binding)

Click to listen. The first one or two distinct keys are committed when all captured keys are released. Repeats, extra keys, and keys held before clicking are ignored. Focus loss cancels unfinished capture.

Options

value
Array of up to two distinct numeric GameKey values. Defaults to {} (unbound).
defaultValue
Optional reset value. Does not set the initial value; pass value to display a binding on creation.
onChange(field, value)
Receives the committed array after capture, clearing, or reset. Construction does not notify.
disabled
Disables interaction. Defaults to false.
width, height
Default size is 240 × 24. Container helpers fill the content width unless a width is supplied.

Methods

GetValue(), SetValue(value, notify?)
Read a copied array or replace the binding. Setting cancels capture; pass true to notify onChange.
StartListening(), CancelListening(), IsListening()
Start, cancel, or query capture. Cancel restores the committed value’s display.
SetDisabled(disabled), Destroy()
Disable interaction or release the control. Disabling or destroying stops capture.

KeybindField helpers

IsDown(value)
True while all keys in a nonempty binding are held, not just on the initial press. False during any keybind field’s capture or when keyboard input is unavailable or blocked. Extra held keys are allowed.
IsCapturing()
Whether any keybind field is listening. Only one can listen at a time.
FormatValue(value)
Returns the display label, such as Ctrl + Shift.

Container helpers. AddKeybindField is available on windows, simple views, panels, tab pages, and collapse sections. Panels synchronize docked and pop-out values and notify once with the paired field handle.

MiniMenu submenus

Add a custom MiniMenu parent whose child actions open in a sprite-backed submenu on hover. PrettyUI places the submenu on the right when it fits, otherwise on the left, and keeps it within the viewport.

MiniMenu.AddSubmenu(miniMenu, label, children, options?) -> MiniMenuEntry

Event.MiniMenuReady.Subscribe("my_plugin_menu", function(event)
    prettyui.MiniMenu.AddSubmenu(event.miniMenu, "Marker options", {
        {
            label = "Add marker",
            action = addMarker,
            arguments = { "red" },
        },
        {
            label = "Remove marker",
            action = removeMarker,
        },
    }, {
        title = "Marker options",
        position = "top",
    })
end)

Call AddSubmenu only with the writable miniMenu supplied by Event.MiniMenuReady. It adds the parent entry immediately and returns that MiniMenuEntry; later MiniMenu:Swap calls during the same Ready event can reorder it without breaking the submenu association.

Child entries

label
Required nonempty text displayed in the submenu.
action
Required function called when the child is selected.
arguments, args
Optional array passed to action with table.unpack. arguments takes precedence when both names are present.

Supply an array of child entries. Children display in array order. When they exceed the available viewport height, use the mouse wheel over the submenu to reach the remaining entries.

Options

title
Submenu header text. Defaults to Choose Option.
parentAction
Function called if the native parent entry itself is selected. Defaults to a no-op; child actions remain independent.
arrow
Appends the native white > direction marker to the parent label unless set to false.
position
Parent entry placement. “top” places the parent directly below the highest-priority native entry so it never becomes the default left-click action. “bottom” places it directly above Cancel and is the default. An integer of 2 or greater selects that 1-based visible row from the top; positions that would reach or pass Cancel clamp to the row directly above it. Visible row 1 and the final Cancel row are reserved for native entries.

Tables

A table is a scrollable, column-based grid for displaying lists of data, with a fixed header and support for custom cell content.

Table.new(parent, options)

local data = {
    {
        bossName = "King Black Dragon",
        bossLevel = 276,
        bossHealth = 45000,
        bossLoc = "Wildy"
    },
    {
        bossName = "Ivar, King of Bones",
        bossLevel = 206,
        bossHealth = 45000,
        bossLoc = "Wildy"
    },
    {
        bossName = "Solak, Guardian of the Grove",
        bossLevel = 7000,
        bossHealth = 2000000,
        bossLoc = " Lost Grove"
    },
}


local bossTable = window:AddTable({
    width = window.root.width - 40,
    height = 300,
    rowHeight = 30,
    emptyText = "No Boss Data to Display",
    stretch = true,
    rows = rows,
    columns = {
        { key = "bossName", label = "Boss Name", width = 150 },
        { key = "bossLevel", label = "Boss Level", width = 60 },
        { key = "bossHealth", label = "Boss Health Total", width = 150, stretch = false },
        { key = "bossLoc", label = "Boss Location", width = 200 },
        { label = "Teleport", width = 150, stretch = false,  
            render = function(cell, rowData, cellWidth, cellHeight)
                return prettyui.SimpleButton.new(cell, "Teleport", function() 
                    print("Teleport")
                end,  {
                    x = 6, y = 2, width = cellWidth - 12, height = cellHeight - 10
                })
            end
        },
        
    }
})

Options

columns
An array of column tables one per column. Each column’s key picks which field of a row it shows and label sets its header text. A table must have at least one column. See the Columns section for every column option.
rows
An array of row tables, one per row displayed in order. Each rows fields are matched to columns by the column’s key so { bossName = "King Black Dragon", bossLevel = 276 } fills the Boss Name and Boss Level columns. Render columns get the whole rows table, so a row can also hold fields that no column shows (IDs, callbacks and so on).
width, height
Default size is 600 × 400.
stretch
When true columns stretch to fill any remaining width. The spare space is shared between stretchable columns in proportion to their starting width, so wider columns get more. Defaults to false.
rowHeight
Sets the height of each row. Default height is 44
headerHeight
Sets the height of the header. Default height is 28
scrollbarGap
The gap(padding) between the scroll bar and the last column. Default is 18
overscan
The amount of additional rows built above and below the viewable rows. Default is 2
emptyText
Displayed when there is no current data in the table.
colours
Overrides the tables default colours. Only pass the colours you want to change. Default Colours
  • header = 0x2A231BFF
  • headerText = 0xF2C66DFF
  • headerHighlight = 0x3A3024FF
  • headerBorder = 0x6B5530FF
  • rowOdd = 0x13110EFF
  • rowEven = 0x181510FF
  • text = 0xE7D7B0FF
  • empty = 0xC9BEA4FF
X, Y
Optional layout overrides.

Columns

key
Column reference key for data to be applied to the right columns, Render columns do not need keys.
label
The text displayed at the top of each column in the header.
width
Width of each column. Default is 100
stretch
When set to false it stops the column from being stretched is stretch in table.options is set to true. Default is true
format
Optional callback function(value, rowData, rowIndex) Allows you to format the text passed in by the original data table without changing the underlying data. format is ignored on render columns. rowData contains all the data for that row including all other keys information.
    { key = "salary", label = "Salary", width = 100, format = function(value, rowData, rowIndex)
        return "$" .. tostring(value)
    end }
render
Optional callback function(cell, rowData, width, height, rowIndex) Allows you to insert custom content (Buttons, Sprites, ItemSlots) into the cell layer. rowData contains all the data for that row including all other keys information.

Methods

GetRows(), SetRows(rows, keepScroll)
Get or Set the row data. GetRows returns the table itself, not a copy. SetRows replaces all row data with rows, passing nil or an empty table displays emptyText. The scrollbar will reset to the top unless keepScroll is set to true, at which point it will stay it was.
SetColumns(columns)
Replaces the column and rebuilds the whole table. Requires at least one column. Scrollbar is reset back to top.
SetPos(x, y)
Moves the table. Passing nil for either value keeps its current position on that axis.
SetSize(width, height)
Resizes the table without a rebuild. Passing nil for either value keeps its current size. Rows are onyl rebuild if a render column changes width.
SetStretch(stretch)
Turns column stretching on or off and resizes the table.
SetRowHeight(rowheight, headerHeight)
Changes the row and/or header height and rebuilds the entire table. Passing nil for either keeps its current value. Scrollbar is reset abck to top.
Refresh()
Rebuilds the rows currently in view from the current row data. Use it after editing rows that are in view
Rebuild(keepScroll)
Destroys and rebuilds the whole table (header, body and rows). Scrollbar resets to the top unless keepScroll is true.