Start typing to search packages!
ui
By @jadonbp
Roblox
Mirrored from WallyUI
Schema-driven UI for Roblox, written in Luau. A page is a ModuleScript that returns a plain table describing it; the library builds it, shows and hides it, and cleans up everything it set up while shown. Client-only singleton.
It covers page lifecycle and layers (pages, overlays, modals), navigation hosts with back history, input on every platform (mouse, touch, gamepad selection, drag and drop, holds, keybinds), animation and transitions, stores and two-way binding, theming on native UI Styling, components (virtualized grids and lists, tabs, sliders, toggles, progress bars, text inputs, toasts, tooltips, confirm dialogs), UI sound, viewport previews, and 2D particles.
Install
[dependencies]
UI = "jadonbp/ui@1.0.0"
Use
-- Client loader
local UI = require(ReplicatedStorage.Packages.UI)
UI.Configure({ Pages = ReplicatedStorage.Client.UI.Pages })
UI.Initialize()
UI:Show("Inventory", { Tab = "Hats" })
-- ReplicatedStorage.Client.UI.Pages.Inventory (plain data: no require of UI, no setup at load)
return {
Frame = function()
return Players.LocalPlayer.PlayerGui:WaitForChild("Main").Inventory
end,
Layer = { Type = "Page" },
Transition = "Slide",
Behaviors = {
Close = {
OnActivated = function(page)
page:Hide()
end,
},
},
Buttons = {
Close = { Target = "Header.Close", Behavior = "Close" },
},
Bindings = {
Count = { Target = "Header.Count", Property = "Text", Store = InventoryCount },
},
OnShow = function(page, data)
-- Everything connected here is cleaned up when the page hides
page:Observe(Coins, function(page, coins)
page.Frame.Header.Coins.Text = tostring(coins)
end)
end,
}
Configure is called with a dot (UI.Configure, UI.Initialize); everything else uses a colon (UI:Show, UI:Hide, UI:Back, UI:Confirm, UI:Toast, UI:ClearToasts).
Global switches are stores: UI.Stores.ReducedMotion:Set(true) and UI.Stores.UISounds:Set(false).
Keeping content across hides
Procedural work goes into scopes (page:Track(instance, "Rows"), and the optional last argument of page:Connect, page:Observe, page:AttachBehavior, page:Create<Type>...), cleared on hide or with page:ClearScope(name). A page shown again often can keep a scope instead (1.5.0):
OnShow = function(page)
page:KeepScope("Rows")
if page:HasScope("Rows") then
return -- built on an earlier show; its observers caught up on changes
end
-- build into "Rows"
end,
A kept scope's instances stay while the page is hidden; its connections, observers, behaviors, bindings and components switch off and back on at the next show. An observer in it, and a Grid or List Observe, runs once on show only if its store changed meanwhile. UI.Configure({ MaxKeptPages = 6 }) caps the hidden pages holding kept content; past it, the least recently shown one drops its kept scopes and builds again on its next show.
Sound
A theme carries its sound set in Values.Sounds, referenced anywhere a sound is expected as "$Name". A sound is an asset id or a spec:
Sounds = {
Click = { Id = "rbxassetid://1", Volume = 0.6 },
-- Variants play in turn, one per play (round-robin)
Hover = { Ids = { "rbxassetid://2", "rbxassetid://3", "rbxassetid://4" }, PitchVariance = 0.03 },
Error = "", -- empty until the sound exists: plays nothing, reports nothing
},
Give either Id or Ids, not both. Volume, PlaybackSpeed, PitchVariance, MinInterval and Looped apply to whichever variant plays. The throttle (MinInterval, 0.05 s by default) is per sound, so a slot's variants share it.
License
MIT
Package Details
Install command (Click to copy)
Version
1.7.1
License
MIT
Safe for commercial use
Automated license review — not legal advice.
