Skip to content

Bind ​

Functions ​

model ​

luau
Bind.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 ​

luau
Bind.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 ​

luau
Bind.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

property ​

luau
Bind.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

on ​

luau
Bind.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