The Reactive Roblox Framework
Build reactive, component-based user interfaces with Rex—a declarative UI framework inspired by React/VueJs patterns, designed specifically for Roblox and Luau.
Build reactive, component-based user interfaces with Rex—a declarative UI framework inspired by React/VueJs patterns, designed specifically for Roblox and Luau.
Rex brings modern web development patterns to Roblox, making UI development faster, more maintainable, and less error-prone.
Rex uses efficient reconciliation algorithms and batched updates to ensure optimal performance. Only elements that actually changed are updated, providing smooth 60+ FPS experiences even with complex UIs.
Build your UI using a simple, declarative syntax with automatic reactivity. State changes automatically update the UI without manual intervention, eliminating common bugs.
Rex is completely self-contained with no external dependencies. Built specifically for Luau and Roblox, it integrates seamlessly into any project without bloating your game.
Rex lets you build UI with readable, maintainable code—no complex hierarchies or boilerplate.
local Rex = require(game.ReplicatedStorage.Rex)
local function Counter()
local count = Rex.useState(0)
return Rex("Frame") {
Size = UDim2.fromScale(1, 1),
BackgroundColor3 = Color3.fromRGB(30, 30, 40),
children = {
Rex("TextLabel") {
Text = count:map(function(value)
return "Count: " .. tostring(value)
end),
Size = UDim2.new(1, 0, 0, 50),
TextColor3 = Color3.new(1, 1, 1),
BackgroundTransparency = 1
},
Rex("TextButton") {
Text = "Increment",
Size = UDim2.fromOffset(120, 40),
Position = UDim2.new(0.5, -60, 0, 60),
BackgroundColor3 = Color3.fromRGB(70, 130, 255),
onClick = function()
count:update(function(current)
return current + 1
end)
end
}
}
}
end
Rex.render(Counter, game.Players.LocalPlayer.PlayerGui)
Rex.useState
creates reactive values that automatically update the UI.
:map()
to derive values from state that update automatically.
onClick
and other events use camelCase naming for consistency.
Rex.render
mounts your component tree to Roblox's GUI system.
Watch how Rex automatically updates the UI when state changes. No manual DOM manipulation required.
local function Counter()
local count = Rex.useState(0)
local color = Rex.useComputed(function()
local value = count:get()
if value < 5 then
return Color3.fromRGB(70, 130, 255)
elseif value < 10 then
return Color3.fromRGB(255, 165, 0)
else
return Color3.fromRGB(255, 70, 130)
end
end, {count})
return Rex("Frame") {
Size = UDim2.fromScale(1, 1),
BackgroundColor3 = Color3.fromRGB(30, 30, 40),
children = {
Rex("TextLabel") {
Text = count:map(function(value)
return "Count: " .. tostring(value)
end),
Size = UDim2.new(1, 0, 0.4, 0),
TextColor3 = Color3.new(1, 1, 1),
TextScaled = true,
BackgroundTransparency = 1
},
Rex("TextButton") {
Text = "Click Me!",
Size = UDim2.fromOffset(200, 60),
Position = UDim2.new(0.5, -100, 0.6, 0),
BackgroundColor3 = color,
TextColor3 = Color3.new(1, 1, 1),
TextScaled = true,
onClick = function()
count:update(function(current)
return current + 1
end)
end
}
}
}
end
Built for Luau with comprehensive type definitions and intellisense support.
UI automatically stays in sync with your application state through reactive bindings.
Build reusable components with props, state, and lifecycle hooks just like React.
Efficient key-based diffing ensures only necessary elements are created, updated, or removed.
Share state across your component tree with Rex's Context API. No prop drilling, just clean, maintainable code.
-- Global theme context
local ThemeContext = Rex.createContext("dark")
local function App()
local theme = Rex.useState("dark")
return Rex.Provider {
context = ThemeContext,
value = theme,
children = {
Header(),
MainContent(),
Footer()
}
}
end
-- Use anywhere in the tree
local function ThemedButton()
local theme = Rex.useContext(ThemeContext)
return Rex("TextButton") {
BackgroundColor3 = theme:map(function(t)
return t == "dark"
and Color3.fromRGB(70, 130, 255)
or Color3.fromRGB(240, 240, 240)
end)
}
end
Join developers who've already made the switch to Rex for cleaner, more maintainable, and more powerful user interfaces.