Skip to content

Gleam

Gleam is the reactive HUD layer (Vide-style): a GleamSource holds value, Gleam.Effect re-runs when dependencies Get, list helpers rebuild via Sweep, and Gleam.Spring steps Coil on Heartbeat until settled. Props use GleamProps { .Field = } — no JSX, no template syntax inside structs. Callbacks are func.

Header: #include <clpp/libs/gleam.clh>. Runtime: CluauppLibs.Gleam.

Use when:

  • Labels and frames should follow data (coins.Set(50) updates bound UI).
  • You want Sweep-owned Activated / mount teardown without manual :Disconnect() lists.
  • Smooth follow animations on sources via Spring.

Do not use when:

  • Server economy or persistence — Keep + Flare.
  • Keyed list diffing — Show / Indexes / Values rebuild instances; mutating a table in place without Set does not notify.
  • Studio debug panels — Lens.
#include <clpp/roblox.clh>
#include <clpp/libs/gleam.clh>
#include <clpp/libs/mint.clh>
#include <clpp/libs/bloom.clh>
#include <clpp/libs/keep.clh>
[[client]]
void init() {
Keep.Client.Init();
Data data = Keep.Client.WaitForData();
GleamSource coins = Gleam.Source(data.Get(Keep.Client.Paths.Currencies.Coins));
Players players = GetService<Players>();
ScreenGui gui = Gleam.ScreenGui(GleamProps { .ResetOnSpawn = false });
TextLabel label = Gleam.TextLabel(GleamProps {
.Name = "Coins",
.TextScaled = true,
});
Gleam.Mount(gui, players.LocalPlayer.PlayerGui);
Gleam.Mount(label, gui);
Gleam.Effect(func () {
label.Text = Mint.Compact(coins.Get());
});
Bloom.Play(label, Bloom.Shine);
}

Full copy: HUD example.

GleamProps fields match Roblox GUI properties and event callbacks (Activated, MouseButton1Click, Changed, …) declared in gleam.clh.

Returns: Current value; registers this Effect as dependent when called inside tracking.

When: Read state inside Gleam.Effect or Gleam.Derive compute.

double v = coins.Get(); // tracks dependency

Returns: void — notifies effects and listeners when value changes (== skips).

When: Push new state from Keep, input, or network handlers.

coins.Set(50); // reruns bound effects

Returns: Unsubscribe func when invoked.

When: Side effects outside Gleam’s effect graph (logging, one-off sound).

coins.Listen(func () { post("changed"); });

Returns: GleamSource with initial value.

When: Root reactive cell; use Gleam.Source(auto) for inferred type.

GleamSource n = Gleam.Source(0);

Returns: GleamSource updated when dependencies inside compute change.

When: Computed values without manual Set wiring.

GleamSource doubled = Gleam.Derive(func () { return coins.Get() * 2; });

Returns: void — runs fn now and whenever dependencies change; Sweep-owned.

When: Sync instances to sources (text, visibility, layout).

Returns: Value returned by fn without recording dependencies.

When: Read a source inside an effect without subscribing (logging, one-time branch).

Returns: void — batches multiple Set notifications until fn finishes.

When: Avoid N effect passes when updating several sources at once.

Returns: void — registers teardown on current effect scope.

When: Disconnect non-Gleam connections when effect re-runs or unmounts.

Returns: Instance of className.

When: Rare classes beyond typed factories.

Instance x = Gleam.Create("Frame");

Returns: Instance with GleamProps applied.

When: One-shot instance + props.

Returns: TextButton.

When: Clickable control with optional GleamProps (.Activated = func () { … }).

Returns: TextButton.

Returns: TextLabel.

When: Static or effect-driven text.

Returns: TextLabel.

Returns: Frame.

When: Layout container.

Returns: Frame.

Returns: ScreenGui.

When: Root under PlayerGui.

Returns: ScreenGui.

Returns: ImageLabel.

When: Icons and thumbnails.

Returns: ImageLabel.

Returns: ScrollingFrame.

When: Scrollable lists (often with Indexes).

Returns: ScrollingFrame.

Returns: LuaArray<Instance> — empty list helper for children arrays.

When: Building child lists for props.

Returns: LuaArray<Instance> with one instance.

Returns: LuaArray<Instance> with two instances.

Returns: LuaArray<Instance> with three instances.

Returns: Unmount func.

When: Parent an instance; teardown unp mounts or destroys per runtime Sweep rules.

Gleam.Mount(label, gui);

Returns: Teardown func for entire reactive root.

When: Wrap bootstrap that creates multiple effects/mounts.

Returns: GleamSource of current child instance (or nil).

When: Swap single child when source value changes; destroys previous instance.

Returns: GleamSource of active branch instance.

When: Enum-like UI where map keys select which builder runs.

Returns: GleamSource of { Instance } aligned to array source.

When: Render {T} lists; each item gets a nested source for row state.

Returns: GleamSource of { Instance } for dictionary/array values.

When: Like Indexes but callback receives value as well as item source.

Returns: GleamSource smoothed toward underlying source with default Coil tuning.

When: Animated position, size, or numbers bound to UI.

GleamSource smooth = Gleam.Spring(coins);

Formula: Uses Coil (ω = frequency × 2π) stepped each Heartbeat until settled.

Returns: GleamSourcespeed maps to spring frequency (Hz).

When: Snappier or slower follow.

Returns: GleamSource — explicit damping ratio and frequency.

When: Fine-tuned motion on HUD elements.

Returns: GleamAction marker for prop tables (runtime runs on instance setup).

When: Imperative setup in props without storing raw Roblox connections yourself.

Returns: Callable GleamApply-style applier — Apply(GleamProps) mutates instance inside Sweep scope.

When: Update an existing instance from an effect.

GleamApply patch = Gleam.Apply(label);
patch.Apply(GleamProps { .Text = "Hi" });

Returns: Instance after applying props once.

When: Single-shot patch without storing applier.

Returns: Instance — applies GleamProps to the bound instance.

When: Returned from Gleam.Apply(instance) in CL++ as chained applier.