Skip to content

Flux ​

Flux: fine-grained reactive UI for Roblox. The reactive graph and the instance API are flat on Flux; utilities live in namespaces (Flux.Color, Flux.Find, Flux.Interact, Flux.Motion, Flux.Responsive, Flux.Store, and the Flux.Defaults and Flux.Flags settings).

luau
local count = Flux.signal(0)
Flux.new "TextButton" {
	Parent = gui,
	Text = function() return `Clicked {count()} times` end,
	Activated = function() count(count() + 1) end,
}

Types ​

Node type ​

luau
type Node<T> = Graph.Node<T>

State type ​

luau
type State<T> = Graph.State<T>

Reactive type ​

luau
type Reactive<T> = Graph.Reactive<T>

Unwrap type ​

luau
type Unwrap<T> = Graph.Unwrap<T>

Owner type ​

luau
type Owner = Graph.Owner

Cleanable type ​

luau
type Cleanable = Graph.Cleanable

Props type ​

luau
type Props<ClassName, Extra = {}> = Type.Merge<Type.Properties<Type.Resolve<ClassName>>, Extra>

Child type ​

luau
type Child = Instance | GraphNode | ((instance: Instance) -> ()) | { [any]: any }

Children type ​

luau
type Children = { Child }

Component type ​

luau
type Component<P, I = Instance> = (props: P) -> I

Partial type ​

luau
type Partial<T> = Edit.Partial<T>

Pick type ​

luau
type Pick<T, G> = Edit.Pick<T, G>

Omit type ​

luau
type Omit<T, G> = Edit.Omit<T, G>

Async type ​

luau
type Async<T> = Async.Async<T>

AsyncState type ​

luau
type AsyncState = Async.AsyncState

Context type ​

luau
type Context<T> = Graph.Context<T>

Selector type ​

luau
type Selector<K> = Conditional.Selector<K>

Spring type ​

luau
type Spring<T> = Motion.Spring<T>

HoverOptions type ​

luau
type HoverOptions = Interact.HoverOptions

Breakpoint type ​

luau
type Breakpoint = Responsive.Breakpoint

Input type ​

luau
type Input = Responsive.Input

Platform type ​

luau
type Platform = Responsive.Platform

TextSize type ​

luau
type TextSize = Responsive.TextSize

DisplaySize type ​

luau
type DisplaySize = Responsive.DisplaySize

Length type ​

luau
type Length = Layout.Length

ReactiveLength type ​

luau
type ReactiveLength = Layout.ReactiveLength

Insets type ​

luau
type Insets = Layout.Insets

Align type ​

luau
type Align = Layout.Align

FlexAlign type ​

luau
type FlexAlign = Layout.FlexAlign

LineAlign type ​

luau
type LineAlign = Layout.LineAlign

Direction type ​

luau
type Direction = Layout.Direction

FlexMode type ​

luau
type FlexMode = Layout.FlexMode

PaddingSides type ​

luau
type PaddingSides = Layout.PaddingSides

CornerSides type ​

luau
type CornerSides = Layout.CornerSides

ListConfig type ​

luau
type ListConfig = Layout.ListConfig

GridConfig type ​

luau
type GridConfig = Layout.GridConfig

StrokeConfig type ​

luau
type StrokeConfig = Layout.StrokeConfig

GradientConfig type ​

luau
type GradientConfig = Layout.GradientConfig

SizeConstraintConfig type ​

luau
type SizeConstraintConfig = Layout.SizeConstraintConfig

TextSizeConstraintConfig type ​

luau
type TextSizeConstraintConfig = Layout.TextSizeConstraintConfig

Properties ​

Color from Motion ​

luau
Flux.Color: Color

Color: a perceptual Color3 toolkit working in gamut-clipped Oklab: lighten/saturate (negative amounts darken/desaturate), mix, rotateHue, and WCAG contrast/readable.

Open Documentation

Defaults Read Only from Edit ​

luau
Flux.Defaults: { [string]: { [string]: unknown } }

Defaults: per-class default properties applied to every Instance built by Flux.new. Mutable.

Open Documentation

Find from Edit ​

luau
Flux.Find: Find

Find: instance selectors for hydration. Child, Descendant, Ancestor, Query and their class-filtered variants apply props to matching instances around the one being edited.

Open Documentation

Flags from Edit ​

luau
Flux.Flags: Flags

Flags: process-wide switches. Flags.defaults turns the per-class defaults of Flux.new on or off.

Open Documentation

otherwise Read Only from Conditional ​

luau
Flux.otherwise: any

The catch-all key of a Flux.switch map: its factory mounts whenever the source matches no other key. Every unmatched value shares it, so moving between two unmatched values keeps the branch mounted.

luau
Flux.switch(state) {
	loading = function() return Spinner {} end,
	[Flux.otherwise] = function(value) return Label { text = value } end,
}

Open Documentation

Functions ​

edit ​

luau
Flux.edit<T>(instance: T & Instance)

Hydrates an existing Roblox Instance: applies reactive properties, events and directives like Flux.new, onto an instance you already have. Bindings created inside a Flux.scope disconnect when the scope is destroyed.

luau
Flux.edit(existingLabel) { Text = function() return `HP {health()}` end }

Open Documentation

new ​

luau
Flux.new<T>(className: T | keyof<Type.Creatable>)

Creates a Roblox Instance of className with its per-class defaults, then takes a property table of values, nodes, getters, events, children, prefix keys (_Prop, _attr_Name, __attr_Name, _tag_Name, __tag_Name), and directives (__EVENT, __ATTR, __TAG, __REF, __CLEAN). Created inside a Flux.scope, the instance is destroyed when the scope is destroyed.

luau
Flux.new "Frame" {
	Size = UDim2.fromScale(1, 1),
	BackgroundTransparency = function() return if hovered() then 0 else 0.5 end,
	_attr_Kind = "Panel",
	_tag_Interactive = true,
	Flux.new "UICorner" {},
}

Open Documentation

signal from Graph ​

luau
Flux.signal(initial: any, equals: any): any

Creates a writable signal holding initial. Reading it inside a reaction subscribes; writing a new value re-runs dependents. equals replaces the ~= change check. A signal is never owned by a scope: the GC reclaims it once dropped.

luau
local count = Flux.signal(0)
count(count() + 1)

Open Documentation

computed from Graph ​

luau
Flux.computed(fn: any, equals: any): any

Creates a lazily cached node derived from fn. It re-evaluates only when read after a dependency changed, and equals stops propagation when the new result compares equal.

luau
local total = Flux.computed(function()
	return price() * quantity()
end)

Open Documentation

effect from Graph ​

luau
Flux.effect(fn: (...any) -> ...any): any

Creates an effect: fn runs on the next flush and again whenever a node it read changes. Returns the effect node; node:Destroy() stops it, as does destroying the scope that created it.

luau
Flux.effect(function() print("count is", count()) end)

Open Documentation

createSignal from Graph ​

luau
Flux.createSignal<T>(initial: T, equals: ((T, T: any) -> boolean)?): (() -> T, (value: T, force: boolean?) -> T)

A signal without a node: returns a getter and a setter, like Solid's createSignal. The getter reads with tracking, like node(); the setter writes, like node:set(value, force) (so nil is a write). They are smaller and faster than a node from Flux.signal, and they work anywhere a getter does (Flux.read, a binding, a prop), but there are no methods: nothing to Destroy (the signal is collected once nothing holds the functions), no onObserved or Flux.dispose.

luau
local count, setCount = Flux.createSignal(0)
Flux.effect(function()
	print(count())
end)
setCount(count() + 1)

createMemo from Graph ​

luau
Flux.createMemo<T>(fn: () -> T, equals: ((T, T) -> boolean)?): () -> T

A computed without a node: returns its getter, like Solid's createMemo. It is owned like Flux.computed (destroyed with the scope or reaction that created it) and reads like node(), but it has no methods.

luau
local count, setCount = Flux.createSignal(1)
local doubled = Flux.createMemo(function()
	return count() * 2
end)

createEffect from Graph ​

luau
Flux.createEffect(fn: (...any) -> ...any)

An effect without a node: schedules fn on the next flush and re-runs it whenever a node it read changes, like Solid's createEffect. It is owned like Flux.effect (destroyed with the scope or reaction that created it), but returns nothing.

luau
local count, setCount = Flux.createSignal(0)
Flux.createEffect(function()
	print("count is", count())
end)

getter from Graph ​

luau
Flux.getter(node: any): any

A plain function that reads node with tracking, like node(): for hot code, since calling it skips the wrapper's __call dispatch. It works anywhere a getter does (Flux.read, a binding, a prop).

luau
local count = Flux.signal(0)
local getCount = Flux.getter(count)
Flux.effect(function()
	print(getCount())
end)

setter from Graph ​

luau
Flux.setter(node: any): any

A plain function that writes node, like node:set(value, force) (so nil is a write): for hot code, since calling it skips the wrapper's __call dispatch.

scope from Graph ​

luau
Flux.scope<T>(fn: (scope: Node<any>) -> T): (Node<any>, T)

Runs fn in a new owner scope and returns (scope, result). The computeds, effects, instances and cleanup values created inside are torn down together by scope:Destroy().

luau
local scope, frame = Flux.scope(function() return Flux.new "Frame" { Parent = gui } end)
scope:Destroy() -- destroys the frame and everything bound to it

Open Documentation

flush from Graph ​

luau
Flux.flush()

Runs the pending effects now instead of on the next frame. Mainly for tests, to observe a write's effects synchronously.

Open Documentation

cleanup from Graph ​

luau
Flux.cleanup(obj: Cleanable)

Registers obj to be disposed, like Flux.dispose, right before the running computed or effect re-runs and when its owner is destroyed, after the owner's children are torn down in both cases. A function receives the owner's previous value and a destroyed boolean (true on final teardown, false on re-computation). Errors outside an owner, and on a value Flux.dispose can't tear down.

luau
Flux.effect(function()
	local connection = button.Activated:Connect(onClick)
	Flux.cleanup(connection)
end)

Open Documentation

dispose from Graph ​

luau
Flux.dispose(obj: Cleanable?)

Disposes obj right now, the same teardown a scope runs on its Flux.cleanup values. A function is called with no arguments, an Instance is destroyed, a connection is disconnected, a suspended thread is canceled, a table is torn down by its Destroy/destroy/ Disconnect/disconnect method (a node, a scope, an async, a selector, a store) or else, when it is an array, each item in turn. It runs untracked, so reads inside a disposed function never subscribe the running reaction. An error is warned, never raised, and anything else (nil included) is ignored.

luau
local connections = { part.Touched:Connect(onTouched), part.Destroying:Connect(onGone) }
Flux.dispose(connections)

Open Documentation

getOwner from Graph ​

luau
Flux.getOwner(): Owner?

Returns the current owner, or nil at the root. Capture it to create reactions from deferred work that still belong to it, with Flux.withOwner.

Open Documentation

withOwner from Graph ​

luau
Flux.withOwner(node: any, fn: () -> ...any): ...any

Runs fn with owner (from Flux.getOwner, or a node) as the current owner, so the reactions and cleanups created inside belong to it, and the context provided where it was created is visible again. Tracking is left as it is. Pass nil to create unowned roots. On an owner already destroyed (a late callback), what fn creates and registers is disposed as soon as fn returns or throws.

Open Documentation

read from Graph ​

luau
Flux.read(object: any): any

Reads a Reactive with tracking: a node's value, a getter's result, or a plain value as is. The way to read a prop that may be any of them.

luau
local function Label(props: { text: Flux.Reactive<string> })
	return Flux.new "TextLabel" { Text = function() return string.upper(Flux.read(props.text)) end }
end

Open Documentation

raw from Graph ​

luau
Flux.raw(object: any): any

Reads a Reactive without tracking: a node's current value, a getter's result (the getter's own reads untracked too), or a plain value as is.

Open Documentation

untrack from Graph ​

luau
Flux.untrack(fn: (() -> ...any)?): ...any

Runs fn without tracking: reads inside don't subscribe the running computed or effect. Returns what fn returns. Called with no function, it stops tracking for the rest of the current run, or until Flux.retrack().

luau
Flux.effect(function()
	local id = selected() -- tracked
	local name = Flux.untrack(function() return names()[id] end) -- not tracked
end)

Open Documentation

retrack from Graph ​

luau
Flux.retrack()

Resumes tracking after a bare Flux.untrack() in the same body, restoring exactly the reaction it suspended, so the pair fences a stretch of untracked reads. Without a matching bare untrack() (in a scope body, inside untrack(fn) or withOwner, or when tracking is already on) it changes nothing. Pair untrack() and retrack() within one function body: a getter read through Flux.raw does not get a slot of its own.

luau
Flux.untrack()
local snapshot = rows()
Flux.retrack()

Open Documentation

isNode from Graph ​

luau
Flux.isNode(object: any): boolean

Whether object is a node.

Open Documentation

isReactive from Graph ​

luau
Flux.isReactive(): boolean

Whether the caller runs inside a tracking computed or effect, where reads subscribe it.

on from Bind ​

luau
Flux.on<D, R>(deps: any, fn: (input: any, prevInput: any?, prevResult: R?) -> R, defer: boolean?): (prevResult: R?) -> R?

Builds an explicit-dependency reaction: it tracks only deps (a single node, function, or value, or an array of them) and runs fn untracked whenever one changes, so reads inside fn never become dependencies. Wrap it in a computed or effect; fn(input, prevInput, prevResult) receives the current input, the previous input, and its own previous result. Pass defer = true to skip the initial run and fire only on subsequent changes.

Open Documentation

context from Graph ​

luau
Flux.context(default: any): any

Creates a context with the given default, read by any code built under a provide without threading it through arguments. Outside any active provide, reads return default. Pair with components to share theme, services, or the current user down a tree.

luau
local Theme = Flux.context("dark")
Theme:provide("light", function() return App {} end) -- App and everything it builds reads "light"

Open Documentation

bindContext from Graph ​

luau
Flux.bindContext<A..., R...>(fn: (A...) -> R...): (A...) -> R...

Wraps fn so every call runs with the context values provided where it was wrapped, as a node created there would. Handlers declared in Flux.new/Flux.edit props get this already; use it for a connection made by hand, a task callback or a callback handed to other code, so a handler that opens a dialog draws it in the trigger's theme. Ownership and tracking are left as they are.

luau
local onClick = Flux.bindContext(function()
	print(ThemeContext:get()) -- the value provided where onClick was made
end)

Open Documentation

async from Async ​

luau
Flux.async(source: any, fetcher: any, initialValue: any): Async<any>

Creates a non-blocking asynchronous node that runs yielding work off the reactive graph and exposes its progress as four nodes: .data (seeded with initialValue before the first fetch resolves), .error, .loading, and .state. source is a tracked input (a node or computation) whose value is passed to fetcher and re-runs it on every change; omit source and pass fetcher first for a one-shot fetch, or let source evaluate to nil/false to gate the fetch off until it turns truthy. fetcher(value, previous, refetching) runs untracked (where previous is the last resolved data and refetching flags a manual refetch, so reactive reads inside it are not tracked as dependencies), and a race guard discards stale results so only the latest fetch ever writes back.

luau
local profile = Flux.async(userId, function(id) return Players:GetNameFromUserIdAsync(id) end)
Flux.new "TextLabel" { Text = function() return profile.data() or "Loading" end }

Open Documentation

selector from Conditional ​

luau
Flux.selector<S, K>(source: S, equals: ((sourceValue: Graph.Unwrap<S>, key: K) -> boolean)?): Selector<K>

Creates an O(1) keyed selector that tracks which of many keys matches source (a node, () -> S computed, or plain value) for row, tab, or focus selection. The returned object is callable: selector(key) reactively reads whether key is selected, so flipping the selection re-runs only the two affected keys instead of every observer. By default keys are compared with ==, flipping at most two per-key nodes per change (O(1)); passing a custom equals(sourceValue, key) comparator re-tests every live key on each change (O(live keys)).

Open Documentation

store from Store ​

luau
Flux.store<T>(initialState: T): T

Wraps a plain table in a deep reactive proxy: reading a field inside a computed or effect subscribes to that field, and assigning a new value re-runs only the dependents of the leaves that changed. Nested plain tables are proxied recursively on access; metatable'd values (Flux nodes, class instances) stay atomic. Available as Flux.store.

Open Documentation

split from Edit ​

luau
Flux.split(props: any, keys: any, ...: any): ...any

Splits a props table by key into fresh tables: one per keys group holding just the keys that group names, then a final table with everything else (instance properties, numeric children, __EVENT-style directives), ready to forward to a root instance. A group is an array of key names or a table whose keys are used; a key named by several groups is assigned to the first group. Values move by reference and props itself is left untouched.

With one group, it is typed as a Pick of the props type and the rest as its Omit, keeping required members required. That needs the names as types: pass a schema table, or annotate a name array (local OWN: { "label" | "onClick" } = ...). An unannotated array resolves to { string }, and several groups are more than the solver can pick through, so those tables are Partial (every member optional).

luau
local OWN: { "label" | "onClick" } = { "label", "onClick" }
local own, rest = Flux.split(props, OWN) -- own.label: string, own.onClick: (() -> ())?

Open Documentation

safe from Graph ​

luau
Flux.safe<T>(tryFn: () -> T, fallback: T | (err: unknown) -> T, equals: ((a: T, b: T) -> boolean)?): Node<T>

Creates a computed that evaluates tryFn and, if it throws, falls back to fallback, re-running and recovering automatically whenever its tracked dependencies change. fallback may be a static value or a recovery function receiving the caught error; a recovery function runs untracked so it cannot accidentally subscribe to extra dependencies, and if it throws in turn, its own error propagates unchanged. Pass equals to customize change detection (default ==).

Open Documentation

property from Bind ​

luau
Flux.property<I, K>(instance: I & Instance, property: K | "Name"): Graph.Node<Type.PropertyType<I, K>>

A node following a property of a Roblox Instance, an attribute when property starts with _attr_ or $, or a CollectionService tag when property starts with _tag_ or #. It is seeded with the current value and set again on every change, and typed after the target: Flux.property(textBox, "Text") is a Node<string>, Flux.property(npc, "#Enemy") (or "_tag_Enemy") is a Node<boolean>, and an attribute (or a name the type can't resolve) gives a Node<any>. The node stops following when it is destroyed.

luau
local text = Flux.property(textBox, "Text")
local health = Flux.property(character, "$Health")
local isEnemy = Flux.property(character, "#Enemy")

Open Documentation

model from Bind ​

luau
Flux.model<N>(node: N): Graph.Unwrap<N>

Wraps a reactive node for two-way binding. Assigning Flux.model(node) to a property (or attribute) drives the Instance from the node AND writes the node back whenever the user changes that property. Only sound for properties that fire a changed signal (e.g. TextBox.Text).

Open Documentation

isModel from Bind ​

luau
Flux.isModel(value: unknown): boolean

Whether value is a Flux.model binding: lets a component tell a two-way value prop from a plain or one-way one.

Open Documentation

modelNode from Bind ​

luau
Flux.modelNode(value: unknown): Graph.Node<any>?

The node inside a Flux.model binding, or nil when value is not one. A component that takes a value prop writes user changes back through it.

luau
local node = Flux.modelNode(props.value)
if node then
	node:set(text)
end

Open Documentation

show from Conditional ​

luau
Flux.show<T, F>(condition: unknown, component: (value: () -> any) -> T, fallback: ((value: () -> any) -> F)?): Node<T | F>

Mounts component while condition is truthy, swapping to fallback (if given) when it turns falsy. Re-evaluates only when condition's truthiness flips, not on every value change. The chosen factory runs once per mount in its own branch scope (the effects and cleanups it registers are torn down automatically on the next swap) and receives a value accessor for the live condition value. Returns a node usable at a numeric index of Flux.new / Flux.edit.

Open Documentation

showKeyed from Conditional ​

luau
Flux.showKeyed<T, F>(condition: unknown, component: (value: () -> any) -> T, fallback: ((value: () -> any) -> F)?): Node<T | F>

Identity-keyed variant of Flux.show: instead of rebuilding only when condition's truthiness flips, it rebuilds whenever the value's identity changes, so swapping one truthy value for another remounts component (or fallback when falsy) with fresh state. The chosen factory runs in its own branch scope and receives a value accessor; since the value is fixed for the branch's lifetime, reading value() in the factory body yields it directly. Mirrors SolidJS's <Show keyed>.

Open Documentation

switch from Conditional ​

luau
Flux.switch<S>(source: S)

Mounts the branch keyed by source's current value. Curries: pass the reactive source, then a map of value → factory; the matching factory runs once in its own branch scope and receives a value accessor. For a keyed branch value() is the matched key (fixed for the branch's lifetime); under Flux.otherwise (which mounts for any unmatched value), value() tracks the live unmatched value. Returns a node usable at a numeric index of Flux.new / Flux.edit.

Open Documentation

presence from Conditional ​

luau
Flux.presence<T>(condition: unknown, component: (exiting: Node<boolean>, done: () -> ()) -> T): Node<T?>

Mounts component while condition is truthy and keeps it mounted through its exit transition. component receives (exiting, done): when condition turns falsy, the branch stays mounted with its boolean exiting node set to true, and unmounts once it calls done() (ignored unless exiting), typically when its exit animation settles. A truthy condition before then reverses the exit (exiting returns to false) instead of remounting. The factory runs once per mount in its own branch scope, like Flux.show, and the returned node works at a numeric index of Flux.new / Flux.edit.

Open Documentation

pick from Conditional ​

luau
Flux.pick(condition: unknown, whenTrue: any, whenFalse: any?): Node<any>

Derives a node that is whenTrue while condition is truthy and whenFalse otherwise (nil when omitted): the terse form of Flux.computed(function() return if Flux.read(cond) then Flux.read(a) else Flux.read(b) end). Every argument may be a plain value, a node, or a () -> T getter, and only the branch actually taken is read, so the untaken side never becomes a dependency and never re-runs the derivation.

  • Unlike Flux.show this picks a value, not a subtree: nothing is mounted, no branch scope is created, and swapping sides does not rebuild anything.
  • Omit whenFalse for a value that is present only while condition holds.

Open Documentation

fallback from Conditional ​

luau
Flux.fallback<V, D>(value: V, default: D): Node<NonNil<Graph.Unwrap<V>> | Graph.Unwrap<D>>

Derives a node that is value while it is non-nil and default otherwise: the terse form of Flux.computed(function() return Flux.read(value) or default end), and the idiomatic way to give an optional prop a default. Either argument may be a plain value, a node, or a () -> T getter, and default is read only while value is nil, so it never becomes a dependency otherwise.

  • Coalesces on nil alone, not on falsiness: a value of false is kept, where or would have replaced it with default. That is the point of reaching for this over or on a Reactive<boolean>? prop.

Open Documentation

forValue from Conditional ​

luau
Flux.forValue<L, U>(list: L, mapFn: (index: Node<number>, value: Item<L>) -> U): Node<{ U }>

Maps list (a plain array, node, or getter) by value (keyed): mapFn(index, value) runs once per unique value, caching each item's mapped result against the value itself so results stay stable across reorders and only the item's reactive index node updates when it moves. Values must be unique: the value is the cache key, so duplicates collapse onto one mapped instance; for primitives, duplicates, or position-based churn use Flux.forIndex instead.

Open Documentation

forIndex from Conditional ​

luau
Flux.forIndex<L, U>(list: L, mapFn: (index: number, item: Node<Item<L>>) -> U): Node<{ U }>

Maps list (a plain array, node, or getter) by index (unkeyed): mapFn(index, item) runs once per position, reusing the mapped result and passing the item as a reactive node that updates in place as the value at that index changes. Reach for this over Flux.forValue when the array holds primitives, has duplicates, or churns by position rather than identity.

Open Documentation

spring from Motion ​

luau
Flux.spring<A>(target: A, frequency: Reactive<number>?, damping: Reactive<number>?, initialVelocity: any?): Spring<Unwrap<A>>

Creates a node that springs toward target, animating any supported value type (numbers, Vector2, UDim2, Color3, …). When target is reactive, the spring retargets on every change, carrying its momentum through. frequency sets oscillations per second (default 1, where higher values snap faster) and damping sets the damping ratio (1 is critically damped with no overshoot, <1 springs past and settles, >1 is sluggish; default 1); both may be reactive. initialVelocity sets the starting velocity in the target's type (read once; omit to start at rest). Read the returned node anywhere to subscribe to the live animated value.

luau
local size = Flux.spring(function() return if open() then 300 else 0 end, 4)

Open Documentation

tween from Motion ​

luau
Flux.tween<A>(target: A, tweenInfo: Reactive<TweenInfo>?): Graph.Node<Unwrap<A>>

Creates a node that animates toward target over a fixed duration described by a TweenInfo (easing style, direction, time, repeats). When target or the TweenInfo is reactive, the tween restarts toward the new goal from its current value, without the DelayTime (a retarget never waits). Read the returned node to subscribe to the live animated value. Prefer a Flux.spring for momentum-driven, interruptible motion.

Open Documentation

padding from Layout ​

luau
Flux.padding(value: Length | PaddingSides | Graph.Node<any> | (() -> Length | Insets)): UIPadding

Creates a UIPadding from a single length (applied to all sides), a per-side { top, bottom, left, right, x, y } table, or a reactive node or function yielding a length or a { top, bottom, left, right } struct. Plain number values are offset pixels; a UDim is used as-is. Reactive sides bind and update in place; a reactive source may change shape between updates, and nil reads as no padding.

Open Documentation

corner from Layout ​

luau
Flux.corner(radius: ReactiveLength | CornerSides?): UICorner

Creates a UICorner rounding the parent's corners. radius is offset pixels or a UDim, optionally reactive; omit it for the engine default (8 px). A { topLeft, topRight, bottomLeft, bottomRight, top, bottom, left, right, radius } table rounds each corner on its own, for a card whose header meets its body or a button at the end of a group; a corner named nowhere keeps the engine default.

Open Documentation

stroke from Layout ​

luau
Flux.stroke(config: StrokeConfig?): UIStroke

Creates a UIStroke outlining the parent. thickness (px), color, and transparency bind reactively; mode is "contextual" (text outline on text objects, border otherwise) or "border", and joins is "round"/"bevel"/"miter", each also accepting the raw Enum or a reactive source. For a border, position is "inner" (drawn inside the parent's box, so nothing around it clips it and a thicker stroke grows inward), "center" or "outer" (the engine default), and offset moves it out (px or a UDim; negative moves it in).

Open Documentation

aspectRatio from Layout ​

luau
Flux.aspectRatio(ratio: Reactive<number>, aspectType: Reactive<"fit" | "scale" | Enum.AspectType>?, dominantAxis: Reactive<"width" | "height" | Enum.DominantAxis>?): UIAspectRatioConstraint

Creates a UIAspectRatioConstraint constraining a frame's width-to-height ratio to ratio. aspectType accepts "fit" (FitWithinMaxSize), "scale" (ScaleWithParentSize), or an Enum.AspectType; dominantAxis accepts "width", "height", or an Enum.DominantAxis (unknown strings warn and fall back). Every argument may be reactive.

Open Documentation

list from Layout ​

luau
Flux.list(config: ListConfig?): UIListLayout

Creates a UIListLayout that arranges siblings in a line with flexbox semantics. gap is the spacing between items (offset px or a UDim); direction is "x"/"y". align sets the cross-axis and justify the main-axis value: "start"/"center"/"end" align items, "between"/"around"/"evenly" distribute the free space, and "stretch"/"fill" resize items to fill the axis. horizontalAlign and verticalAlign provide explicit axis-pinned overrides; wraps flows items onto multiple lines, and lineAlign aligns items within their wrapped line. Every value, including direction, may be reactive; alignments re-route when a reactive direction flips.

Open Documentation

grid from Layout ​

luau
Flux.grid(config: GridConfig?): UIGridLayout

Creates a UIGridLayout that arranges siblings in a uniform grid. cell is the cell size and gap is the spacing; each accepts a Vector2, a number (offset px), or a UDim2. fill is the flow direction "x"/"y"; align/justify map to horizontal/vertical alignment; maxCells caps cells per line. Every value may be reactive.

Open Documentation

flex from Layout ​

luau
Flux.flex(mode: Reactive<FlexMode | Enum.UIFlexMode>?): UIFlexItem

Creates a UIFlexItem controlling how a child grows or shrinks inside a flex UIListLayout. mode is "fill" (the default when omitted), "grow", "shrink", or "none", or a raw Enum.UIFlexMode, optionally reactive.

Open Documentation

gradient from Layout ​

luau
Flux.gradient(config: GradientConfig?): UIGradient

Creates a UIGradient. color takes a Color3, an array of stops spread evenly from start to end, or a ColorSequence; transparency takes a number, an array of stops, or a NumberSequence. rotation is in degrees, and offset and enabled map straight through. Every value may be reactive; a reactive stop array re-spreads when it changes.

Open Documentation

sizeConstraint from Layout ​

luau
Flux.sizeConstraint(config: SizeConstraintConfig?): UISizeConstraint

Creates a UISizeConstraint bounding its parent's size. min and max are whole Vector2 bounds; minWidth, minHeight, maxWidth, and maxHeight set a single axis and win over the matching vector component. An axis not specified in config remains unconstrained. Every value may be reactive.

Open Documentation

textSizeConstraint from Layout ​

luau
Flux.textSizeConstraint(config: TextSizeConstraintConfig?): UITextSizeConstraint

Creates a UITextSizeConstraint bounding the text size of its parent to min/max pixels; an omitted bound keeps the engine default (1 and 100). A max also caps the enlargement players get from a larger preferred text size. Both values may be reactive.

Open Documentation

Metamethods ​

__call ​

luau
Flux.__call(_: any, obj: any, propertyName: string?): Graph.Node<any>

The terse constructor: Flux(value) is a signal, Flux(fn) a computed, and Flux(instance, property) a node following a Roblox Instance property, "$Attribute" / "_attr_Attribute", or "#Tag" / "_tag_Tag". A node is returned as is. The result is a Node<any>; use Flux.signal, Flux.computed, Flux.effect and Flux.property for typed nodes.

luau
local size = Flux(frame, "AbsoluteSize")

Open Documentation

Clock ​

Clock: the time Flux and your code run on. now (monotonic) and wall (Unix, server-synced) read it; delay, wait, defer, cancel and connect(phase, fn) schedule on it, like task.* and the RunService frame signals. Tests turn on a manual clock (manual(true); always on headless): step(seconds, frameLength?) advances time, runs due timers and frame subscribers, steps springs and tweens, and flushes the reactive graph in order; drain runs deferred work and reset cancels all pending tasks.

Open Documentation

now from Clock ​

luau
Flux.Clock.now(): number

Seconds on a monotonic clock, for measuring intervals: os.clock() in a game, virtual time on a manual clock.

wall from Clock ​

luau
Flux.Clock.wall(): number

Unix time in seconds, for dates and countdowns shared between players: workspace:GetServerTimeNow() in a game, 2026-01-01T00:00:00Z + now() on a manual clock.

delay from Clock ​

luau
Flux.Clock.delay<A...>(seconds: number?, fn: ((A...) -> ...any) | thread, ...: A...): thread

Runs fn(...) (or resumes a thread) after seconds, like task.delay. Returns the thread, for cancel.

wait Yields from Clock ​

luau
Flux.Clock.wait(seconds: number?): number

Yields the running thread for seconds (default: one frame), like task.wait, and returns the time it waited. On a manual clock it waits for a step to pass the deadline, so it needs a coroutine to yield.

defer from Clock ​

luau
Flux.Clock.defer<A...>(fn: ((A...) -> ...any) | thread, ...: A...): thread

Runs fn(...) (or resumes a thread) once the current work finishes, like task.defer. On a manual clock it waits for drain() (which every step frame calls). Returns the thread, for cancel.

cancel from Clock ​

luau
Flux.Clock.cancel(thread: thread)

Cancels a thread from delay, defer or a wait, like task.cancel.

connect from Clock ​

luau
Flux.Clock.connect(phase: Phase, fn: (dt: number) -> ()): () -> ()

Calls fn(dt) every frame at phase ("PreRender", "RenderStepped" or "Heartbeat"). Returns a function that disconnects it. A manual clock calls it from step instead of the engine's frames.

manual from Clock ​

luau
Flux.Clock.manual(on: boolean)

Tests only: turns the manual clock on or off. Headless Luau is always manual (manual(false) does nothing there). Turning it on starts virtual time at os.clock(); turning it off drops what was pending, like reset().

isManual from Clock ​

luau
Flux.Clock.isManual(): boolean

Tests only: whether the clock is manual.

step from Clock ​

luau
Flux.Clock.step(seconds: number, frameLength: number?)

Tests only: advances a manual clock by seconds, in frames of at most frameLength seconds (default 1/60). step(0) runs one frame of zero length: due timers, subscribers, a Flux step and the deferred work.

drain from Clock ​

luau
Flux.Clock.drain()

Tests only: runs deferred work until none is left, including work it defers in turn. Errors after 10000 calls, when deferred work keeps deferring more.

reset from Clock ​

luau
Flux.Clock.reset()

Tests only: drops every pending timer, wait, deferred call and manual subscriber. now keeps its value.

Interact ​

Interact: interaction state as read-only boolean nodes (hover, press, selected, focused) and the hit tests pointIn, sunk and covered.

Open Documentation

pointIn from Interact ​

luau
Flux.Interact.pointIn(x: number, y: number, object: GuiObject): boolean

Whether the point (x, y) lies within object's absolute bounds (inclusive, ignoring rotation). Coordinates are inset-relative, matching InputObject.Position and AbsolutePosition.

Open Documentation

sunk from Interact ​

luau
Flux.Interact.sunk(x: number, y: number, object: GuiObject, token: any?): boolean

Whether input at (x, y) would be claimed by an Active or input-sinking gui rendered above object, e.g. dropping a hover state while a floating menu covers the control. Outside a BasePlayerGui (a plugin dock, a SurfaceGui in workspace) nothing can claim the point, so this yields false. With token (the InputObject), the hit test is asked once per input per point, however many objects under the pointer ask.

Open Documentation

covered from Interact ​

luau
Flux.Interact.covered(x: number, y: number, object: GuiObject, token: any?): boolean

Whether input at (x, y) would be claimed by an Active or input-sinking gui above object that is not inside it: another panel, window or menu on top. Unlike sunk, the object's own buttons don't count, so a container (a scrolling list, a row list you drag to reorder, a window's body) still hears a press on its rows while nothing else covers it.

Open Documentation

hover from Interact ​

luau
Flux.Interact.hover(object: GuiObject, options: HoverOptions?): Graph.Node<boolean>

Whether a mouse pointer or touch contact is over object with no input-claiming gui drawn above it (see sunk), as a read-only boolean node. It is settled again every frame the pointer is in its bounds, so a menu or dialog opening over it, the pointer moving onto one, a scroll that carries it away, or it hiding drops the hover, and the cover closing over a still pointer brings it back. With { within = true }, only guis outside object cover it (see covered): a row or card stays hovered over its own buttons. Listening starts on call and stops when the node, the scope that created it, or object is destroyed, which settles it false.

Open Documentation

press from Interact ​

luau
Flux.Interact.press(object: GuiObject): Graph.Node<boolean>

Whether object is held down, as a read-only boolean node: from a left mouse button or touch that begins on it (unless a gui above claims the input), or ButtonA/Enter pressed while it is the GuiService.SelectedObject and no text box has focus, until that same input ends anywhere, so dragging off a control never leaves it stuck. It cleans up like hover.

Open Documentation

selected from Interact ​

luau
Flux.Interact.selected(object: GuiObject): Graph.Node<boolean>

Whether object is the GuiService.SelectedObject, the gui that gamepad or keyboard UI navigation currently highlights, as a read-only boolean node. It cleans up like hover.

Open Documentation

focused from Interact ​

luau
Flux.Interact.focused(textBox: TextBox): Graph.Node<boolean>

Whether textBox has keyboard focus, as a read-only boolean node seeded from IsFocused() and kept current by Focused and FocusLost. It cleans up like hover.

Open Documentation

Motion ​

Motion: the engine behind Flux.spring and Flux.tween. step(dt?) advances every motion (wired to the frame automatically); call it yourself only to step motion in tests.

Open Documentation

step from Motion ​

luau
Flux.Motion.step(dt: number?)

Advances every active spring and tween by the same dt seconds, or by the time since the last step. Wired automatically to RunService.PreRender on a client and RunService.Heartbeat on a server, so you call it yourself only to step motion in tests: Flux.Motion.step(1 / 60).

Open Documentation

Responsive ​

Responsive: the screen and the player as nodes: viewport, scale, and breakpoint follow the camera; displaySize and platform report the physical screen dimensions and device category; input follows the active input device; textSize, reducedMotion, and preferredTransparency track accessibility settings. scaleOf/breakpointOf build per-surface variants; config holds the defaults.

Open Documentation

config Read Only from Responsive ​

luau
Flux.Responsive.config: Config

Live defaults shared by every derived node; mutate once at startup.

Open Documentation

platform Read Only from Responsive ​

luau
Flux.Responsive.platform: Graph.Node<Platform>

The device class: "vr", "console" (ten-foot interface), "pc" (keyboard and mouse), or "mobile". Live on the client, so plugging in a keyboard and mouse or putting on a headset changes it; "pc" elsewhere.

Open Documentation

viewport Read Only from Responsive ​

luau
Flux.Responsive.viewport: Graph.Node<Vector2>

The active camera's ViewportSize as a node, live on the client.

Open Documentation

scale Read Only from Responsive ​

luau
Flux.Responsive.scale: Graph.Node<number>

UIScale factor derived from viewport; 1.0 at config.reference.

Open Documentation

breakpoint Read Only from Responsive ​

luau
Flux.Responsive.breakpoint: Graph.Node<Breakpoint>

Size class derived from viewport width.

Open Documentation

displaySize Read Only from Responsive ​

luau
Flux.Responsive.displaySize: Graph.Node<DisplaySize>

How large the screen is physically (GuiService.ViewportDisplaySize): "Small" (phones, tablets, handhelds), "Medium" (laptops and monitors, the default) or "Large" (TVs). Live on the client; where the engine lacks the property, a ten-foot interface counts as "Large".

Open Documentation

input Read Only from Responsive ​

luau
Flux.Responsive.input: Graph.Node<Input>

The input the player is using right now: "keyboard" (keyboard and mouse), "touch", or "gamepad". Follows UserInputService.PreferredInput live on the client, so picking up a controller switches it; elsewhere it holds the mode matching platform.

Open Documentation

textSize Read Only from Responsive ​

luau
Flux.Responsive.textSize: Graph.Node<TextSize>

The player's preferred text size (GuiService.PreferredTextSize): "Medium" (default), "Large", "Larger", or "Largest". The engine already draws text larger to match, so use it to make room around text, never to multiply TextSize again.

Open Documentation

reducedMotion Read Only from Responsive ​

luau
Flux.Responsive.reducedMotion: Graph.Node<boolean>

Whether the player asked for reduced motion (GuiService.ReducedMotionEnabled). When true, swap movement and scaling animations for instant changes or simple fades.

Open Documentation

preferredTransparency Read Only from Responsive ​

luau
Flux.Responsive.preferredTransparency: Graph.Node<number>

The player's background transparency preference (GuiService.PreferredTransparency), from 0 (opaque backgrounds) to 1 (the default). Multiply translucent BackgroundTransparency values by it.

Open Documentation

scaleOf from Responsive ​

luau
Flux.Responsive.scaleOf(partial: PartialConfig?): Graph.Node<number>

Factory escape hatch: a scale node with per-surface config (merged over defaults).

Open Documentation

breakpointOf from Responsive ​

luau
Flux.Responsive.breakpointOf(partial: PartialConfig?): Graph.Node<Breakpoint>

Factory escape hatch: a breakpoint node with per-surface thresholds.

Open Documentation

Store ​

Store: helpers for Flux.store proxies: insert, remove and move for arrays, reconcile to diff in a snapshot, unwrap for the raw table, and Destroy.

Open Documentation

insert from Store ​

luau
Flux.Store.insert(proxy: any, posOrValue: any, value: any?)

Reactive counterpart of table.insert: with no third argument, appends posOrValue to the end; with a third argument, inserts value at 1-based position posOrValue and shifts subsequent elements up. Use this instead of assigning past the array's length so iteration and # watchers fire and the shifted indices re-sync. An out-of-range position errors.

Open Documentation

remove from Store ​

luau
Flux.Store.remove(proxy: any, pos: number?): any

Reactive counterpart of table.remove: removes and returns the element at pos (default: the last), shifting subsequent elements down. Use this instead of proxy[i] = nil, which leaves a hole that corrupts the array part. An out-of-range pos errors.

Open Documentation

move from Store ​

luau
Flux.Store.move(proxy: any, from: number, to: number)

Reactively reorders the array, moving the element at 1-based index from to to and shifting the elements between them so positional readers and #/iteration watchers follow. Equivalent to a table.remove + table.insert but as a single tracked step: the length is unchanged, so nothing is removed and no nested proxy is torn down, ideal for drag-and-drop list reordering. Both indices must be in [1, #proxy]; an out-of-range index errors.

Open Documentation

reconcile from Store ​

luau
Flux.Store.reconcile<T>(proxy: T, newData: T, key: string?): T

Diffs the snapshot newData into the live store proxy, firing only the nodes whose leaves actually changed and reusing unchanged nested proxies instead of tearing them down. Arrays diff positionally by default; when key is given, array elements are matched by element[key] instead (recursively through every nested array), so reordered or inserted rows keep their proxy (and their Flux.forValue result) and only changed rows fire. newData should be a plain, acyclic snapshot. Returns proxy.

Open Documentation

unwrap from Store ​

luau
Flux.Store.unwrap<T>(proxy: T): T

Returns the raw, un-proxied table underlying a store: the live backing object, not a copy. Reads through it bypass tracking entirely (no node is subscribed), so use it for cheap snapshots or to hand a plain table to non-reactive code. Passing a value that is not a store returns it unchanged.

Open Documentation

Destroy from Store ​

luau
Flux.Store.Destroy<T>(proxy: T)

Tears down a store and every nested proxy beneath it, destroying their per-key nodes so dependents stop tracking them; the proxy is left an empty plain table and the raw table is left intact. A store created inside a scope is torn down when the scope is destroyed; Flux.dispose performs the same cleanup. An unreferenced store is garbage-collected automatically; call this method only to disconnect its dependents early.

Open Documentation