Start typing to search packages!
fable
By @jaylers
Roblox
Mirrored from WallyFable UI Roblox
Fine-grained reactive UI for Roblox (Luau), with responsive scaling built in. Bind a property to state and only that property is rewritten when the state changes: no virtual tree, no diffing.
English | ไทย
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Fable = require(ReplicatedStorage.Fable)
local scope = Fable.scoped() -- owns everything below; scope:destroy() cleans it all up
local clicks = scope:Value(0)
scope:New "ScreenGui" {
Parent = Players.LocalPlayer:WaitForChild("PlayerGui"),
[Fable.Children] = {
scope:New "TextButton" {
Size = UDim2.fromOffset(240, 60),
Text = scope:Computed(function(use)
return `Clicked {use(clicks)} times` -- follows `clicks`
end),
[Fable.OnEvent "Activated"] = function()
clicks:set(clicks:get() + 1)
end,
},
},
}
Why Fable
- Responsive in the box. Design once on a 1920x1080 canvas (
scope:ResponsiveGui), size text and buttons in real pixels (scope:Px), change the layout per device (scope:Breakpoint). The example inventory passes on nine emulated devices, from a 1920x1080 desktop to phones: nothing overflows, text is at least 12 px and buttons at least 44 px. See the responsive guide. - Fast, measured. Numbers from Roblox Studio on an M1 Pro, against hand-written code doing the same work
(full page):
- a state change costs about 0.43 microseconds more than writing the property yourself: 1.02x for an expensive
property such as
Text, about 2x for the cheapest (Rotation,Size), where the whole write is under a microsecond; - many changes in one frame are written once: 3 to 4 times faster than writing each, 150 times for
Text; - a 500-item list (add, remove, reorder) is 0.85x to 1.48x of a hand-written loop and creates no Instance when only values change;
- 200 animations run in one loop (one scope per frame in the MicroProfiler);
- building and destroying a UI 1,000 times leaves nothing behind, and a 30-minute run with 500 live slots shows flat memory.
- a state change costs about 0.43 microseconds more than writing the property yourself: 1.02x for an expensive
property such as
- No leaks by construction. Everything is created through a scope, and
scope:destroy()removes every Instance, binding and connection. - No runtime dependencies. One ModuleScript tree, client first, strictly typed (
--!strict).
Phase 1 is the core plus responsive UI. There is no ready-made component set (Button, Dialog...), no theme system and no server state sync; they may come later.
Install
Fable is a ModuleScript named Fable in ReplicatedStorage. Two ways (the steps are in
getting-started.md):
- Drag a file in: insert
Fable.rbxminto Studio and put theFableModuleScript in ReplicatedStorage. Build the file yourself withrojo build default.project.json -o Fable.rbxmuntil a release is published. - Rojo / Wally: map
src/intoReplicatedStorage.Fablein your Rojo project. The Wally package (jaylers/fable) will be available with the first release.
Learn it
| Getting started | Install and build your first UI that follows state |
| API reference | Every call, with checked examples |
| Responsive guide | ResponsiveGui, Px, Breakpoint: when to use which |
| Examples | Hello counter, animated window, responsive inventory, 500-slot stress test |
| Deep dives | core reactivity, instances, lists, animation, responsive details, performance, known issues |
Status
Phase 1 is complete; version 0.1.0 is prepared for release (see CHANGELOG.md and docs/releasing.md). The spec is FABLE_SPEC.md (in Thai).
Development setup
rokit install # rojo, wally, stylua, selene, luau-lsp, lune
wally install # installs dev dependencies (Jest-Lua) into DevPackages/
rojo sourcemap dev.project.json -o sourcemap.json
Apple Silicon: Wally 0.3.2 ships no arm64 macOS binary, so
rokit installcannot run it (needs Rosetta). Build it once withcargo install --git https://github.com/UpliftGames/wally --tag v0.3.2 --locked wallyand make sure~/.cargo/bincomes before~/.rokit/binon PATH.
Generated, git-ignored helpers used by the checks below:
selene generate-roblox-std
curl -sSfLO https://raw.githubusercontent.com/JohnnyMorganz/luau-lsp/main/scripts/globalTypes.d.luau
Checks
stylua --check src tests scripts examples
selene src tests scripts examples
luau-lsp analyze --definitions=globalTypes.d.luau --sourcemap=sourcemap.json src tests examples
lune run scripts/check-docs # runs the code samples of the documentation
Tests
- Reactive core:
lune run scripts/run-tests - Core micro-benchmarks (Lune):
lune run scripts/bench - Everything, in the real engine: sync the code into a throwaway Studio place with Rojo
(
rojo serve dev.project.json+ the Rojo plugin) and runscripts/studio/run-tests.luauwith the Roblox_Studio MCP toolexecute_luau. Details: docs/testing.md.
Package Details
Install command (Click to copy)
Version
0.1.0
License
MIT
Safe for commercial use
Automated license review — not legal advice.
