Documentation Index
Fetch the complete documentation index at: https://mintlify.com/hetari/creative-coding/llms.txt
Use this file to discover all available pages before exploring further.
LilGui wraps the lil-gui library and exposes a controls prop — an array of control descriptors, each linked to a Vue ref. Dragging a slider, picking a color, or choosing a dropdown option writes the new value directly back into the bound ref, making the change instantly reactive anywhere that ref is consumed. Equally, if your sketch code updates a ref programmatically, LilGui detects the change through a watch and calls controller.updateDisplay() to keep the panel in sync — giving you true two-way binding between the GUI and your application state.
Props
An array of control descriptor objects. Each descriptor specifies a Vue ref to bind and optional metadata that determines what kind of control is rendered (slider, color picker, or dropdown).
The GuiControl Interface
Each element in the controls array must conform to the following shape:
- If
type: 'color'— a color picker is rendered usinggui.addColor(). - Else if
optionsis set — a dropdown is rendered usinggui.add(target, key, options). - Otherwise — a slider is rendered using
gui.add(target, key, min, max, step).
Usage
The example below is taken from the Shader / Learn sketch, which usesLilGui to expose animation speed, glow intensity, and palette color controls directly in the scene:
Positioning
The GUI panel is injected with the following inline styles on mount:| Property | Value |
|---|---|
position | fixed |
top | 60px |
left | 10px |
right | auto |
zIndex | 9999 |
gui.close()) so it doesn’t obstruct the sketch on first load. Click the title bar to expand it.
Iframe-aware
On mount,LilGui calls useIsPreview(). If the component detects it is running inside a preview iframe, the entire lil-gui initialization is skipped — no DOM is injected and no watchers are registered. This keeps dashboard preview cards clean.
Two-way sync
For every control whoseref is a Vue ref object, LilGui registers a watch on ref.value. When the watched value changes from outside the GUI (e.g. a programmatic reset), target[key] is updated and controller.updateDisplay() is called to reflect the new value in the panel without triggering the onChange handler in a loop.
Color pickers
When a control descriptor includestype: 'color', LilGui calls gui.addColor(target, key) instead of gui.add(). Bind a hex string ref (e.g. ref('#803333')) and the color picker will read and write the hex value directly.