A UI & State management library for ROBLOX, based of ROACT and REACT
For more detailed examples, please refer to the documentation! Below is a basic script. Usually you would break these scripts down into smaller modules that each contain Components.
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
local UltraViolet = require(ReplicatedStorage.Packages.UltraViolet)
local myComponent = UltraViolet.Components:Create("Button")
myComponent:SetState({
buttonPress = 0
})
local function initScreen()
return UltraViolet.CreateElement("ScreenGui", {
Properties = {
Name = "Container",
IgnoreGuiInset = true
}
})
end
function myComponent:render()
local newScreen = initScreen():Construct(Players.LocalPlayer.PlayerGui)
return UltraViolet.CreateElement("TextButton", {
Properties = {
Parent = newScreen,
AnchorPoint = Vector2.new(.5, .5),
Position = UDim2.fromScale(.5, .5),
Size = UDim2.fromOffset(200,50),
Text = `Clicked {tostring(myComponent:GetStateFromName("buttonPress"))} times!`
},
Events = {
MouseButton1Click = function(rbx, obj)
obj:Destroy()
UltraViolet.CreateElement(myComponent, {}):Construct()
myComponent:SetState(function(state)
return {
buttonPress = state.buttonPress + 1
}
end)
end,
}
})
end
UltraViolet.CreateElement(myComponent, {}):Construct()
UltraViolet is available under the Apache 2.0 license. See LICENSE.txt for details."# UltraViolet"