Skip to content

UI ​

Types ​

Dict type ​

luau
type Dict<T> = { [T]: any }

Symbol type ​

luau
type Symbol = { type: "Symbol" }

Platform type ​

luau
type Platform = "Console" | "Mobile" | "PC" | "VR"

ActiveStateType type ​

luau
type ActiveStateType = "hover" | "floating" | "dialog"

TextRequest type ​

luau
type TextRequest = { Text: string, Font: Font, Size: number, RichText: boolean? }

Properties ​

Class ​

luau
UI.Class

Sound ​

luau
UI.Sound

Haptic ​

luau
UI.Haptic

GuiService ​

luau
UI.GuiService: GuiService

TextService ​

luau
UI.TextService: TextService

UserInputService ​

luau
UI.UserInputService: UserInputService

LocalPlayer ​

luau
UI.LocalPlayer

PlayerGui ​

luau
UI.PlayerGui

Touch ​

luau
UI.Touch

IsConsoleScreen ​

luau
UI.IsConsoleScreen: boolean

Platform ​

luau
UI.Platform: Platform

Hook ​

luau
UI.Hook: Symbol

A marker for defining UI state hooks in UI.edit

Function ​

luau
UI.Function: Symbol

A marker for defining function defaultState in UI.makeStatefulDefaults

Nil ​

luau
UI.Nil: Symbol

A marker for defining Nil defaultState in UI.makeStatefulDefaults

TopbarInset ​

luau
UI.TopbarInset

GuiService.TopbarInset as a Flux state

TopbarPadding ​

luau
UI.TopbarPadding: any

LayerBottom ​

luau
UI.LayerBottom

The lowermost ScreenGui for UI components

LayerDefault ​

luau
UI.LayerDefault

The default ScreenGui for UI components

LayerTop ​

luau
UI.LayerTop

The topmost ScreenGui for UI components

LayerTopInset ​

luau
UI.LayerTopInset

LayerTopbar ​

luau
UI.LayerTopbar

The Topbar ScreenGui for UI components

TopbarFrame ​

luau
UI.TopbarFrame

A sorted Topbar Frame for UI components, parented under UI.LayerTopbar

Fonts Module ​

luau
UI.Fonts: Fonts

Theme Module ​

luau
UI.Theme: Theme

Themes from Theme ​

luau
UI.Themes: {}

Functions ​

getFontName ​

luau
UI.getFontName(font: Font | Enum.Font)

flush ​

luau
UI.flush()

Flushes pending reactive updates unless inside a UI.batch.

batch ​

luau
UI.batch<T>(fn: () -> T): T

Defers intermediate Flux.flush() calls from UI.new/UI.edit until fn finishes. Do not yield inside fn.

activateState ​

luau
UI.activateState(activeState: any, stateType: ActiveStateType)

A generalized function to handle activation/deactivation of both floating and hover states

deactivateState ​

luau
UI.deactivateState(activeState: any, stateType: ActiveStateType)

A generalized function to deactivate both floating and hover states

toggleState ​

luau
UI.toggleState(activeState: any, stateType: ActiveStateType)

A generalized function to toggle both floating and hover states

clearState ​

luau
UI.clearState(stateType: ActiveStateType)

Function to clear a specific state type

clearActiveStates ​

luau
UI.clearActiveStates()

Function to clear all active state types

invertLuminance ​

luau
UI.invertLuminance(color: Color3, amount: number): Color3

Inverts the luminance of a Color3 by an amount

retryGetTextBoundsAsync Yields ​

luau
UI.retryGetTextBoundsAsync(params): Vector2

textWidth ​

luau
UI.textWidth(getRequests: () -> { TextRequest }): (Flux.Node<number>, Flux.Node<any>)

Measures the widest of getRequests() without yielding inside the reactive graph. getRequests runs in an effect (its reads are tracked); the returned signal starts at an estimate and settles to the measured width once TextService:GetTextBoundsAsync resolves on a deferred thread. Stale measurements are dropped. Never call UI.retryGetTextBoundsAsync inside a computed, effect, or reactive property: it yields mid-flush, which stalls Flux and corrupts dependency tracking for every other thread. Returns the width signal and the measuring effect; dispose both with the owning component.

makeStatefulDefaults ​

luau
UI.makeStatefulDefaults(default: Dict<any>, definition: Dict<any>?)

Helper function for defining Flux state defaults

newSinkHoverState ​

luau
UI.newSinkHoverState(object: GuiObject, hovering: any?, options: Flux.HoverOptions?)

edit ​

luau
UI.edit(new: Instance | Dict<any>)

Inherits Flux.edit

  • Parents children to the ._content variable of a UI component if one exists
  • Unwraps UI component children and auto-numbers [GuiObject.LayoutOrder] sequentially via Flux.edit
  • Allows UI.Hook to easily hook to default UI state or RBXScriptSignal aliases

new ​

luau
UI.new(className: string)

Creates a new Instance with UI.edit

notifyDisplayWatchers ​

luau
UI.notifyDisplayWatchers()

Re-evaluates all deferred UI display watchers after an ancestor visibility change.

onFirstDisplayed ​

luau
UI.onFirstDisplayed(inst: GuiObject, buildFn: () -> ())

Runs buildFn once when inst and all its GuiObject ancestors are first displayed.

register ​

luau
UI.register(className: string, class: Dict<any>)

Registers a new UI component class

registerClasses ​

luau
UI.registerClasses(): typeof(UI)

Run to register the default classes for the UI module (classes load lazily on demand via UI.Class.__index)

fromHex from Color ​

luau
UI.fromHex(hex: any, fallback: Color3?): Color3

Parses a hex string into a Color3, returning fallback (default white) when nil or invalid.

getLuminance from Motion ​

luau
UI.getLuminance(c: Color3): number

Gets the luminance of a Color3

pointInGuiObject from Interact ​

luau
UI.pointInGuiObject(x: number, y: number, object: GuiObject): boolean

Checks if x, y is within the absolute bounds of the GuiObject

sinkInput from Interact ​

luau
UI.sinkInput(x: number, y: number, object: GuiObject, token: any?): boolean

Returns true when input at (x, y) would be claimed by an Active or input-sinking GUI rendered above object (or while the Roblox escape menu is open). Pass the InputObject as token to share the hit-test query across multiple controls on the same input event.

Open Documentation