kohltastrophe/flux
Reactive UI library for Luau.
Be lazy. Do more. Go fast.
Flux is a reactive UI library for Luau. It's strictly typed for accurate autocomplete, batches updates once per frame, and keeps syntax terse enough to read like plain Luau.
Flux leans on Luau's type checker so your editor does the heavy lifting. When you declare a TextLabel or Frame, you get autocomplete for every valid property, event, and expected type.
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Flux = require(ReplicatedStorage.Flux)
local new = Flux.new
local count = Flux(0)
new "ScreenGui" {
Parent = playerGui,
new "TextButton" {
Size = UDim2.fromOffset(200, 50),
Text = function() return `Clicks: {count}` end,
Activated = function() count(count + 1) end,
},
}
Every reactive node supports __call and operator overloading, so reading and writing state takes no extra ceremony. Call count() to read and count(1) to write. Arithmetic and string interpolation track dependencies automatically, so reactive expressions read like normal Luau (use explicit count() == 0 or count() < 5 reads in comparisons).
Dormant computations sleep with zero subscriptions until something observes them. Active bindings batch updates once per frame and run in dependency order. If a computed value doesn't change, downstream bindings don't re-run.
Batteries Included
Flux includes the building blocks you need for Roblox interfaces:
- Reactive State: Track values with
signal,fromSignal,computed,effect, and nestedstoreproxies. - Networked State: Replicate server-authoritative and per-player signals to clients with
Flux.Sync. - Declarative Instances & Components: Build trees with
new,mountinto roots, target external parents withportal, wire up templates withedit, and compose props withsplitandmerge. - Scoped Cleanup: Wrap a tree in
scopeto tear down all of its instances and reactions with oneDestroycall. - Control Flow & Lists: Render conditional branches with
showandswitch, or map dynamic lists withforValue,forKey, andforIndex. - Built-in Motion: Animate any state with physics springs, tweens, or perceptual color blending.
- UI Utilities: Read screen breakpoints, track pointer and gamepad interactions, and drop in terse
flexandscalelayout helpers. - Async & Testing: Run race-safe
asyncfetches, catch failures withsafe, and step a virtualClockin tests.
Installation
Install kohltastrophe/flux with Wally or pesde (pesde add kohltastrophe/flux), or download Flux.rbxm from Releases and place the module in ReplicatedStorage. Rojo users can sync the src directory directly.
Read the Getting Started guide to build your first component.
Acknowledgments
Flux is inspired by:
Sponsors
Flux is free and MIT-licensed. If Flux is useful to you or your team, you can support its development through GitHub Sponsors or Ko-fi.
License
Flux is released under the MIT License.