Home › Overview › MainModule
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).
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
type Node<T> = Graph.Node<T>State type
type State<T> = Graph.State<T>Reactive type
type Reactive<T> = Graph.Reactive<T>Unwrap type
type Unwrap<T> = Graph.Unwrap<T>Owner type
type Owner = Graph.OwnerCleanable type
type Cleanable = Graph.CleanableProps type
type Props<ClassName, Extra = {}> = Type.Merge<Type.Properties<Type.Resolve<ClassName>>, Extra>Child type
Children type
type Children = { Child }Component type
type Component<P, I = Instance> = (props: P) -> IPartial type
type Partial<T> = Edit.Partial<T>Pick type
type Pick<T, G> = Edit.Pick<T, G>Omit type
type Omit<T, G> = Edit.Omit<T, G>Async type
type Async<T> = Async.Async<T>AsyncState type
type AsyncState = Async.AsyncStateContext type
type Context<T> = Graph.Context<T>Selector type
type Selector<K> = Conditional.Selector<K>Spring type
type Spring<T> = Motion.Spring<T>HoverOptions type
type HoverOptions = Interact.HoverOptionsBreakpoint type
type Breakpoint = Responsive.BreakpointInput type
type Input = Responsive.InputPlatform type
type Platform = Responsive.PlatformTextSize type
type TextSize = Responsive.TextSizeDisplaySize type
type DisplaySize = Responsive.DisplaySizeLength type
type Length = Layout.LengthReactiveLength type
type ReactiveLength = Layout.ReactiveLengthInsets type
type Insets = Layout.InsetsAlign type
type Align = Layout.AlignFlexAlign type
type FlexAlign = Layout.FlexAlignLineAlign type
type LineAlign = Layout.LineAlignDirection type
type Direction = Layout.DirectionFlexMode type
type FlexMode = Layout.FlexModePaddingSides type
type PaddingSides = Layout.PaddingSidesCornerSides type
type CornerSides = Layout.CornerSidesListConfig type
type ListConfig = Layout.ListConfigGridConfig type
type GridConfig = Layout.GridConfigStrokeConfig type
type StrokeConfig = Layout.StrokeConfigGradientConfig type
type GradientConfig = Layout.GradientConfigSizeConstraintConfig type
type SizeConstraintConfig = Layout.SizeConstraintConfigTextSizeConstraintConfig type
type TextSizeConstraintConfig = Layout.TextSizeConstraintConfigProperties
Color from Motion
Flux.Color: ColorColor: a perceptual Color3 toolkit working in gamut-clipped Oklab: lighten/saturate (negative amounts darken/desaturate), mix, rotateHue, and WCAG contrast/readable.
Defaults Read Only from Edit
Flux.Defaults: { [string]: { [string]: unknown } }Defaults: per-class default properties applied to every Instance built by Flux.new. Mutable.
Find from Edit
Flux.Find: FindFind: instance selectors for hydration. Child, Descendant, Ancestor, Query and their class-filtered variants apply props to matching instances around the one being edited.
Flags from Edit
Flux.Flags: FlagsFlags: process-wide switches. Flags.defaults turns the per-class defaults of Flux.new on or off.
otherwise Read Only from Conditional
Flux.otherwise: anyThe 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.
Flux.switch(state) {
loading = function() return Spinner {} end,
[Flux.otherwise] = function(value) return Label { text = value } end,
}Functions
edit
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.
Flux.edit(existingLabel) { Text = function() return `HP {health()}` end }new
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.
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" {},
}signal from Graph
Flux.signal(initial: any, equals: any): anyCreates 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.
local count = Flux.signal(0)
count(count() + 1)computed from Graph
Flux.computed(fn: any, equals: any): anyCreates 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.
local total = Flux.computed(function()
return price() * quantity()
end)effect from Graph
Flux.effect(fn: (...any) -> ...any): anyCreates 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.
Flux.effect(function() print("count is", count()) end)createSignal from Graph
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.
local count, setCount = Flux.createSignal(0)
Flux.effect(function()
print(count())
end)
setCount(count() + 1)createMemo from Graph
Flux.createMemo<T>(fn: () -> T, equals: ((T, T) -> boolean)?): () -> TA 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.
local count, setCount = Flux.createSignal(1)
local doubled = Flux.createMemo(function()
return count() * 2
end)createEffect from Graph
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.
local count, setCount = Flux.createSignal(0)
Flux.createEffect(function()
print("count is", count())
end)getter from Graph
Flux.getter(node: any): anyA 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).
local count = Flux.signal(0)
local getCount = Flux.getter(count)
Flux.effect(function()
print(getCount())
end)setter from Graph
Flux.setter(node: any): anyA 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
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().
local scope, frame = Flux.scope(function() return Flux.new "Frame" { Parent = gui } end)
scope:Destroy() -- destroys the frame and everything bound to itflush from Graph
Flux.flush()Runs the pending effects now instead of on the next frame. Mainly for tests, to observe a write's effects synchronously.
cleanup from Graph
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.
Flux.effect(function()
local connection = button.Activated:Connect(onClick)
Flux.cleanup(connection)
end)dispose from Graph
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.
local connections = { part.Touched:Connect(onTouched), part.Destroying:Connect(onGone) }
Flux.dispose(connections)getOwner from Graph
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.
withOwner from Graph
Flux.withOwner(node: any, fn: () -> ...any): ...anyRuns 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.
read from Graph
Flux.read(object: any): anyReads 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.
local function Label(props: { text: Flux.Reactive<string> })
return Flux.new "TextLabel" { Text = function() return string.upper(Flux.read(props.text)) end }
endraw from Graph
Flux.raw(object: any): anyReads 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.
untrack from Graph
Flux.untrack(fn: (() -> ...any)?): ...anyRuns 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().
Flux.effect(function()
local id = selected() -- tracked
local name = Flux.untrack(function() return names()[id] end) -- not tracked
end)retrack from Graph
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.
Flux.untrack()
local snapshot = rows()
Flux.retrack()isNode from Graph
Flux.isNode(object: any): booleanWhether object is a node.
isReactive from Graph
Flux.isReactive(): booleanWhether the caller runs inside a tracking computed or effect, where reads subscribe it.
on from Bind
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.
context from Graph
Flux.context(default: any): anyCreates 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.
local Theme = Flux.context("dark")
Theme:provide("light", function() return App {} end) -- App and everything it builds reads "light"bindContext from Graph
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.
local onClick = Flux.bindContext(function()
print(ThemeContext:get()) -- the value provided where onClick was made
end)async from Async
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.
local profile = Flux.async(userId, function(id) return Players:GetNameFromUserIdAsync(id) end)
Flux.new "TextLabel" { Text = function() return profile.data() or "Loading" end }selector from Conditional
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)).
store from Store
Flux.store<T>(initialState: T): TWraps 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.
split from Edit
Flux.split(props: any, keys: any, ...: any): ...anySplits 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).
local OWN: { "label" | "onClick" } = { "label", "onClick" }
local own, rest = Flux.split(props, OWN) -- own.label: string, own.onClick: (() -> ())?safe from Graph
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 ==).
property from Bind
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.
local text = Flux.property(textBox, "Text")
local health = Flux.property(character, "$Health")
local isEnemy = Flux.property(character, "#Enemy")model from Bind
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).
isModel from Bind
Flux.isModel(value: unknown): booleanWhether value is a Flux.model binding: lets a component tell a two-way value prop from a plain or one-way one.
modelNode from Bind
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.
local node = Flux.modelNode(props.value)
if node then
node:set(text)
endshow from Conditional
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.
showKeyed from Conditional
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>.
switch from Conditional
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.
presence from Conditional
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.
pick from Conditional
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.showthis picks a value, not a subtree: nothing is mounted, no branch scope is created, and swapping sides does not rebuild anything. - Omit
whenFalsefor a value that is present only whileconditionholds.
fallback from Conditional
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
nilalone, not on falsiness: avalueoffalseis kept, whereorwould have replaced it withdefault. That is the point of reaching for this overoron aReactive<boolean>?prop.
forValue from Conditional
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.
forIndex from Conditional
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.
spring from Motion
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.
local size = Flux.spring(function() return if open() then 300 else 0 end, 4)tween from Motion
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.
padding from Layout
Flux.padding(value: Length | PaddingSides | Graph.Node<any> | (() -> Length | Insets)): UIPaddingCreates 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.
corner from Layout
Flux.corner(radius: ReactiveLength | CornerSides?): UICornerCreates 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.
stroke from Layout
Flux.stroke(config: StrokeConfig?): UIStrokeCreates 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).
aspectRatio from Layout
Flux.aspectRatio(ratio: Reactive<number>, aspectType: Reactive<"fit" | "scale" | Enum.AspectType>?, dominantAxis: Reactive<"width" | "height" | Enum.DominantAxis>?): UIAspectRatioConstraintCreates 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.
list from Layout
Flux.list(config: ListConfig?): UIListLayoutCreates 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.
grid from Layout
Flux.grid(config: GridConfig?): UIGridLayoutCreates 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.
flex from Layout
Flux.flex(mode: Reactive<FlexMode | Enum.UIFlexMode>?): UIFlexItemCreates 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.
gradient from Layout
Flux.gradient(config: GradientConfig?): UIGradientCreates 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.
sizeConstraint from Layout
Flux.sizeConstraint(config: SizeConstraintConfig?): UISizeConstraintCreates 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.
textSizeConstraint from Layout
Flux.textSizeConstraint(config: TextSizeConstraintConfig?): UITextSizeConstraintCreates 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.
Metamethods
__call
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.
local size = Flux(frame, "AbsoluteSize")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.
now from Clock
Flux.Clock.now(): numberSeconds on a monotonic clock, for measuring intervals: os.clock() in a game, virtual time on a manual clock.
wall from Clock
Flux.Clock.wall(): numberUnix 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
Flux.Clock.delay<A...>(seconds: number?, fn: ((A...) -> ...any) | thread, ...: A...): threadRuns fn(...) (or resumes a thread) after seconds, like task.delay. Returns the thread, for cancel.
wait Yields from Clock
Flux.Clock.wait(seconds: number?): numberYields 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
Flux.Clock.defer<A...>(fn: ((A...) -> ...any) | thread, ...: A...): threadRuns 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
Flux.Clock.cancel(thread: thread)Cancels a thread from delay, defer or a wait, like task.cancel.
connect from Clock
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
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
Flux.Clock.isManual(): booleanTests only: whether the clock is manual.
step from Clock
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
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
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.
pointIn from Interact
Flux.Interact.pointIn(x: number, y: number, object: GuiObject): booleanWhether the point (x, y) lies within object's absolute bounds (inclusive, ignoring rotation). Coordinates are inset-relative, matching InputObject.Position and AbsolutePosition.
sunk from Interact
Flux.Interact.sunk(x: number, y: number, object: GuiObject, token: any?): booleanWhether 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.
covered from Interact
Flux.Interact.covered(x: number, y: number, object: GuiObject, token: any?): booleanWhether 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.
hover from Interact
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.
press from Interact
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.
selected from Interact
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.
focused from Interact
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.
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.
step from Motion
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).
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.
config Read Only from Responsive
Flux.Responsive.config: ConfigLive defaults shared by every derived node; mutate once at startup.
platform Read Only from Responsive
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.
viewport Read Only from Responsive
Flux.Responsive.viewport: Graph.Node<Vector2>The active camera's ViewportSize as a node, live on the client.
scale Read Only from Responsive
Flux.Responsive.scale: Graph.Node<number>UIScale factor derived from viewport; 1.0 at config.reference.
breakpoint Read Only from Responsive
Flux.Responsive.breakpoint: Graph.Node<Breakpoint>Size class derived from viewport width.
displaySize Read Only from Responsive
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".
input Read Only from Responsive
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.
textSize Read Only from Responsive
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.
reducedMotion Read Only from Responsive
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.
preferredTransparency Read Only from Responsive
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.
scaleOf from Responsive
Flux.Responsive.scaleOf(partial: PartialConfig?): Graph.Node<number>Factory escape hatch: a scale node with per-surface config (merged over defaults).
breakpointOf from Responsive
Flux.Responsive.breakpointOf(partial: PartialConfig?): Graph.Node<Breakpoint>Factory escape hatch: a breakpoint node with per-surface thresholds.
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.
insert from Store
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.
remove from Store
Flux.Store.remove(proxy: any, pos: number?): anyReactive 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.
move from Store
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.
reconcile from Store
Flux.Store.reconcile<T>(proxy: T, newData: T, key: string?): TDiffs 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.
unwrap from Store
Flux.Store.unwrap<T>(proxy: T): TReturns 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.
Destroy from Store
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.