devuiGuideDemosAPIGitHub

Setting up

The default gui, or your own. Importing devui makes gui, but a GUI does nothing until it's first used: something added or shown, a timeline, load(), linkFile(), persist(id), save() or clearSaved(). Only then does it read what's saved and listen for its hotkey (a command with a key listens as soon as it's added). gui.configure({ autoShow, hotkey, persist }) changes those options (persist before first use), and createGUI(options) makes another GUI with its own. Call configure() before anything that uses gui: a module imported ahead of your entry file that adds a control starts it first.

import { createGUI, gui } from '@haxiomic/devui';

gui.configure({ hotkey: 'g', autoShow: false });   // the default gui, before first use
const tools = createGUI({ title: 'Tools', side: 'left', persist: 'tools' });   // or one of your own
Option
persistWhere values and layout are saved: an id (default location.pathname), false for nowhere, or { id, values, layout } (see Saving and loading)
autoShowShow the panel when the first control is added (default true)
hotkeyThe key that shows and hides the panel (default h, null for none)
titleThe panel's title (default devui)
sideThe side it docks to at first, 'right' (default) or 'left'
containerThe element the panel's host goes in (default document.body)
theme, labelWidthIts colours and label column (see Themes)
compareKeyThe key held for A/B (default `, null for none)
extensionsExtensions to use from the start, as gui.use() does
gestureThe scrub gesture's constants: thresholds, the edge lock, the long-press time, gearing
hdrHDR in the panel (the texture inspector's HDR view, HDR colours' swatches): 'auto' (on HDR displays, following the window, the default), 'force' or 'off'

The panel: gui.show() (it loads the first time), gui.hide(), gui.toggle(), gui.show(visible); await gui.ready() waits until it's mounted; gui.dispose() takes it all away. gui.hide({ remember: false }) hides it without keeping it hidden on the next load.

Events: gui.on(name, fn) returns a function that removes it.

EventWhen
changeA value changed: { path, control, value, source, transient } (transient while a drag is still going)
finishA change finished: the end of a drag, an edit, a preset
pressA button was pressed
commandA command ran, from the palette, a hotkey or code
visibilityThe panel showed or hid
compareA/B started or ended, or A changed
fileThe linked values file's status changed
themeThe panel's theme changed
insetsWhat windows docked full length along the edges cover changed (see Windows)
frameYou called gui.update() after rendering, which lets texture views copy from the frame you just drew