Skip to content

API ​

The public surface of PeanutUI, as exported from UI/init.luau.

Widgets ​

Declarative widget constructors. See the widget or space references for details.

ExportDescription
SpaceRender root widget.
createScreenSpace(name)Shortcut for Space.createScreenSpace.
createBillboardSpace(name)Shortcut for Space.createBillboardSpace.
createSurfaceSpace(name)Shortcut for Space.createSurfaceSpace.
getScreenSpace(name)Shortcut for Space.getScreenSpace.
getBillboardSpace(name)Shortcut for Space.getBillboardSpace.
getSurfaceSpace(name)Shortcut for Space.getSurfaceSpace.
FrameWidget constructor for Frame.
ScrollingFrameWidget constructor for ScrollingFrame.
CanvasGroupWidget constructor for CanvasGroup.
ImageLabelWidget constructor for ImageLabel.
ImageButtonWidget constructor for ImageButton.
TextLabelWidget constructor for TextLabel.
TextButtonWidget constructor for TextButton.
TextBoxWidget constructor for TextBox.
ViewportFrameWidget constructor for ViewportFrame.
VideoFrameWidget constructor for VideoFrame.

Components ​

ExportDescription
defineComponent(fn)Creates a component with lifecycle controls.
onSetup(fn)Runs after the component function creates its widget.
onCreated(fn)Runs when the Roblox GUI object is created.
onBeforeDestroyed(fn)Runs before destruction; widget and object still available.
onDestroyed(fn)Runs after destruction.
If(cond, fn)Reactive branching. See Conditionals & Loops.
For(items, fn)Static loop over items.
ReactiveFor(items, fn)Reactive loop over items.
Lazy(fn)Defers widget creation until the ObjectCreateScheduled stage. See Lazy.
makeStory(fn)Defines a story for in-engine preview.

Reactivity ​

ExportDescription
Ref(value)Creates a ref.
Computed(fn)Creates a computed ref.
Reactive(table, shallow?)Wraps a table in a reactive proxy.
getRef(proxy)Gets the ref backing a reactive proxy field.
toRef(proxy, key)Reads a reactive proxy field as a ref.
isRef(obj)Whether a value is a ref.
isEqual(a, b)Creates a computed boolean comparing a ref to a value or ref.
unwrap(valueOrRef)Returns the value, reading .value if given a ref.
watch(ref, fn, params?)Watches a ref and calls fn on change. See Watch & WatchEffect.
watchEffect(fn)Runs fn immediately and re-runs it when any ref read inside it changes. See Watch & WatchEffect.
Size(...)Reactive size constructor. See Units.
Position(...)Reactive position constructor.
Unit(...)Reactive unit constructor.
PositionFromUDim2(udim2)Converts a UDim2 to a Position.
UnitFromUDim(udim)Converts a UDim to a Unit.
ToUDim2(value)Converts a Size, Position, or UDim2 to a UDim2.
ToUDim(value)Converts a Unit, UDim, or number to a UDim.
simpleScaleResponsive pixel scaling for a Space. See Scaling.
preferredInputReactive preferred input ("gamepad", "desktop", "touch").
globalSignalsGlobal signals.

Animations ​

ExportDescription
AnimationsAnimation constructors and makeAnimation.
TransitionsTransition constructors (Transitions.Ease, ...).

Scheduler ​

See the Scheduler reference for stages, phases, and the full API.

ExportDescription
SchedulerScheduler module (Scheduler.defer, Scheduler.waitFor, ...)
defer(fn)Schedule work for the defer stage.
settled(fn)Schedule work for the settled stage.
idle(fn)Schedule work for the idle stage.
waitFor(fn)Wait for a condition across scheduler stages.

Info ​

ExportDescription
versionVersion table.
versionStringVersion string.

Misc ​

ExportDescription
LoggingLogging module (logger.error, logger.critical, ...).
UndefinedThe Undefined sentinel, distinct from nil.