Pre-Release — API subject to change

Displays

Part of the ProControls for p5.js documentation.

New here? See the Getting Started page for HTML setup, script tags, a minimal sketch, and the common options table.

Displays VUMeter VUDial LEDMeter ADSRDisplay Markup ConsolePanel TimeGraphPanel StatusPanel ListView GridView HeatMapView

Displays

Read-only meters and animated displays driven by assigning .value each frame, plus interactive data views (ListView, GridView, HeatMapView) for browsing and selecting structured data.

VUMeter Display

Extends AnalogSlider. Overlays a segmented LED column (green → yellow → red) with peak hold on top of the fader track. Drive it each frame by assigning .value from audio analysis.

new VUMeter(opts)
Inherits all AnalogSlider options. Defaults overridden: readout: 'db', showScale: false, min: 0, max: 1.

Additional options

OptionTypeDefaultDescription
segCountnumber20Number of LED segments.
meterWidthnumber8Pixel width of the LED column.
colorLowstring'#00cc44'Segment color for the lower 60%.
colorMidstring'#cccc00'Segment color for 60–85%.
colorHighstring'#cc2200'Segment color for the top 15%.
showFaderbooleantruefalse = hide the fader cap entirely for a pure display meter.

Example

editable — changes update the preview

VUDial Display

Extends Dial. Replaces the filled arc with a ring of segmented LEDs with peak hold. Use showKnob: false for a pure meter ring, or true to show both the set position and the live level.

new VUDial(opts)
Inherits all Dial options. Defaults overridden: readout: 'db', showScale: false, min: 0, max: 1.

Additional options

OptionTypeDefaultDescription
segCountnumber24Number of LED arc segments.
colorLowstring'#00cc44'Color for the lower 60%.
colorMidstring'#cccc00'Color for 60–85%.
colorHighstring'#cc2200'Color for the top 15%.
showKnobbooleantruefalse = pure LED ring with no knob body.

Example

editable — changes update the preview

LEDMeter Display

A 7-segment numeric display. Segments are drawn as beveled hexagons with a canvas glow. Values are right-aligned; if the number is too wide for the digit slots, all segments show -----. Assign .value each frame.

new LEDMeter(opts)

Options

OptionTypeDefaultDescription
digitsnumber5Number of digit positions (including sign).
readoutstring'raw''raw', 'percent', or 'db'. dB clamps at −99 at min.
decimalsnumber2Decimal places. The dot is drawn in the gap between digits — no extra slot needed.
digitWnumber14Width of each digit character in pixels.
digitHnumber26Height of each digit. Segment thickness scales with this.
digitGapnumber4Gap between digits. Decimal point is centered here.
ledColorstringnullLED color. null uses theme.capIndicator.

Example

editable — changes update the preview
Panel width = padding×2 + digits×digitW + (digits−1)×digitGap. With defaults a 5-digit meter is 106 px wide.

ADSRDisplay Display

A display-only ADSR envelope graph inside a beveled panel. The envelope shape updates live whenever any property changes — pair it with dials or sliders to visualise synth parameters in real time.

new ADSRDisplay(opts)

Options

OptionTypeDefaultDescription
x, ynumber0Top-left position of the panel.
widthnumber220Panel width in pixels.
heightnumber120Panel height in pixels.
attacknumber0.1Attack time — any consistent unit (seconds, ms, etc.). Relative to decay and release.
decaynumber0.2Decay time.
sustainnumber0.7Sustain amplitude level, 0–1.
releasenumber0.3Release time.
envelopeColorstringnullLine and fill tint. null uses theme.capIndicator.
labelstring''Label drawn below the panel.
themeobject{}Partial theme override. See Themes.

Visual layout

Attack, Decay, and Release are displayed proportionally across 70% of the plot width. The sustain hold occupies the remaining 30% as a fixed visual segment. A, D, S, R labels appear below each segment; dashed dividers mark the phase boundaries.

Example

editable — changes update the preview

Markup Display

A scrollable text panel that renders a subset of Wiki Markup syntax — headings, bold, italic, bullet and numbered lists, indented blocks, horizontal rules, and links. Set text at any time to update the content; the panel re-parses and scrolls to the top automatically.

new Markup(opts)

Options

OptionTypeDefaultDescription
x, ynumber0Top-left position of the panel.
widthnumber280Panel width in pixels.
heightnumber200Panel height (visible viewport) in pixels.
textstring''Wiki Markup source. Can be set at any time.
fontSizenumber12Base font size in pixels. Headings scale relative to this.
paddingnumber10Inner padding on all sides.
lineSpacingnumber1.5Line-height multiplier applied to fontSize.
onClickfunctionnullonClick(url[, control]) — called on any click. url is the link's URL string when a link is clicked, or null when clicking non-link text.
themeobject{}Partial theme override. See Themes.

Properties

PropertyTypeDescription
textstring (get/set)Current markup source. Setting resets scroll to top.
scrollYnumber (get/set)Current vertical scroll offset in pixels. Clamped to valid range automatically.

Wiki Markup syntax

SyntaxRenders as
= Heading 1 =Large heading with underline rule
== Heading 2 ==Medium heading
=== Heading 3 ===Small heading
'''bold'''Bold text
''italic''Italic text
'''''bold italic'''''Bold italic text
[[label]] or [[url|label]]Link text (rendered in accent color)
* itemBullet list item
** itemSub-bullet list item
# itemNumbered list item
## itemSub-numbered list item
: textIndented block with left bar
----Horizontal rule
(blank line)Paragraph gap

Scrolling

When content is taller than the panel, a thin scrollbar appears on the right edge. Scroll with the mouse wheel while hovering the panel. Set scrollY programmatically to jump to any position.

Example

editable — changes update the preview

ConsolePanel Display

A floating, scrollable log panel that intercepts console.log, console.warn, console.error, and console.info calls as well as uncaught runtime errors and unhandled promise rejections. Messages are color-coded by type, timestamped, and always auto-scroll so the most recently added line is visible at the bottom. Consecutive identical messages (same type and text) are collapsed into a single entry showing the repeat count and the most recent timestamp — e.g. [12:04:31 ×5] redraw tick. A CLR button clears the log; a −/+ toggle minimizes the panel to just its title bar. The panel is movable, resizable, and minimizable by default.

new ConsolePanel(opts)

Options

OptionTypeDefaultDescription
x, ynumber20, 20Canvas position of the panel's top-left corner.
widthnumber400Panel width in pixels.
heightnumber200Panel height in pixels.
labelstring'Console'Text shown in the title bar.
movablebooleantrueWhen false the panel cannot be repositioned by dragging.
resizablebooleantrueA resize grip appears in the bottom-right corner; drag it to resize the panel at runtime.
minimizablebooleantrueA −/+ toggle button appears in the title bar; clicking it collapses the panel to just the title bar.
minimizedbooleanfalseInitial minimized state.
maxMessagesnumber100Maximum number of messages retained. Oldest messages are dropped when the buffer is full.
timestampsbooleantruePrefix each message with a [HH:MM:SS] timestamp. Set to false to suppress.
interceptstring[]['log','warn','error','info']The console methods to intercept. Pass a subset to limit capture, e.g. ['error','warn'].
themeobject{}Partial theme override. See Themes.

Properties & methods

NameDescription
.clear()Clears all messages and resets scroll. Same as clicking the CLR button.
.messagesRead-only getter. Returns a shallow copy of the message array. Each entry is { type, text, time, count }; count is ≥ 1 when consecutive identical messages have been collapsed.
.remove()Removes the panel and restores all intercepted console methods to their originals.
.minimizedGet/set. When true the panel collapses to just the title bar.
.labelRead/write. Text shown in the title bar.
.resizableRead/write. Enables or disables the resize grip at runtime.
.minimizableRead/write. Shows or hides the minimize toggle button.
.movableRead/write. Enables or disables title-bar dragging at runtime.

Global helpers

For quick use, two standalone functions manage a single shared ConsolePanel without you needing to hold a reference to it. The panel is created the first time openConsolePanel() is called and reused on every subsequent call — the log history is preserved across open/close cycles.

FunctionDescription
openConsolePanel(opts?) Creates the global ConsolePanel on the first call, passing any ConsolePanel options you like (label, width, resizable, etc.). On every subsequent call it simply makes the panel visible again — opts is ignored after the panel already exists. Returns the ConsolePanel instance.
closeConsolePanel() Hides the panel (visible = false). The object and all its log data are preserved — calling openConsolePanel() again brings it back exactly as it was.
editable — changes update the preview

Message colors

SourceColor
console.logTheme label color (default text)
console.infoTheme accent / indicator color
console.warnAmber #cc8800
console.error / uncaught errorsRed #dd3333

Interaction

GestureEffect
Drag title barRepositions the panel (when movable is true).
Click −/+ buttonMinimizes or restores the panel (when minimizable is true).
Scroll wheelScrolls the message log. The next incoming message will always snap back to the bottom.
Drag scrollbarScrolls by dragging the thin scrollbar on the right edge (visible when content overflows).
Click CLR buttonClears all messages.
Drag resize gripResizes the panel from the bottom-right corner (when resizable is true).
Console passthrough: intercepted methods still call the original browser console functions, so DevTools output is unaffected. Call .remove() to fully restore the originals.

Example

editable — changes update the preview

TimeGraphPanel Display

A scrolling time-series line graph panel. Push data points each frame to plot them against time — the oldest point scrolls off the left edge as new ones arrive on the right. Pass a plain number to plot a single variable, or an object ({key: value, …}) to plot multiple named variables simultaneously, each drawn in its own color with a legend. Y-axis range is auto-scaled to the data with 8% padding, or fixed by setting min and max. The panel is movable, resizable, and minimizable by default.

new TimeGraphPanel(opts)

Options

OptionTypeDefaultDescription
x, ynumber20, 20Canvas position of the panel's top-left corner.
widthnumber360Panel width in pixels.
heightnumber200Panel height in pixels.
labelstring'Time Graph'Text shown in the title bar.
maxSamplesnumber200Maximum number of data points retained. Oldest points are discarded when the buffer is full.
autoAdjustYbooleantrueAutomatically fit the Y axis to the min/max of the data currently in the buffer. Set to false to use fixed min/max bounds instead.
minnumber0Fixed Y-axis minimum. Only used when autoAdjustY is false.
maxnumber1Fixed Y-axis maximum. Only used when autoAdjustY is false.
lineWidthnumber1.5Stroke weight for data lines in pixels.
gridbooleantrueShow horizontal grid lines at 25%, 50%, and 75% of the Y range.
legendbooleantrueShow a color legend in the top-right corner of the plot (only visible when graphing multiple variables).
movablebooleantrueAllow repositioning by dragging the title bar.
resizablebooleantrueShow a resize grip in the bottom-right corner.
minimizablebooleantrueShow a −/+ toggle button to collapse the panel to just the title bar.
minimizedbooleanfalseInitial minimized state.
themeobject{}Partial theme override. See Themes.

Properties & methods

NameDescription
.push(value)Add a data point. Pass a number for single-variable mode, or a plain object ({key: value, …}) for multi-variable mode. To supply a custom timestamp, include a time field (in seconds): push({time: 5.2, value: 42}) for single-variable or push({time: 5.2, key1: 42, key2: 99}) for multi-variable. Without a time field the current wall-clock time is used. Switching between modes resets the data buffer.
.clear()Remove all data points and reset variable tracking.
.autoAdjustYGet or set whether the Y axis auto-fits to the data range (true) or uses fixed bounds (false).
.dataRead-only getter. Returns a shallow copy of the current data array.
.minimizedGet/set. Collapses the panel to just the title bar when true.
.visibleGet/set. Hides the panel and suppresses events when false.

Example — single variable

Example — multiple variables

Example — custom timestamps


StatusPanel Display

A compact real-time metrics display showing frame rate, frame time, control count, and JavaScript heap memory usage. Designed for performance monitoring during development and debugging. By default anchors to the bottom of the canvas; provide x and y to position it manually. Visible only when you explicitly create it — useful for identifying bottlenecks or checking that control interactions aren't dragging down frame rate.

new StatusPanel(opts)

Options

OptionTypeDefaultDescription
x, ynumberautoCanvas position. When both are omitted, the panel anchors to the bottom-left of the canvas and resizes with it. Provide both to position manually.
widthnumberautoPanel width in pixels. When using auto-positioning, defaults to canvas width.
heightnumber24Panel height in pixels. A minimal bar showing all metrics.
visiblebooleantrueInitial visibility. Set to false to hide the panel; toggle with panel.visible = true/false.

Properties & methods

NameDescription
.visibleGet/set panel visibility. When false the panel and all its metrics stop updating.
.widthPanel width in pixels. Auto-updated when auto-positioning is active and canvas is resized.
.heightPanel height in pixels — read-only in this version.

Displayed metrics

Example — default position (bottom of canvas)

Example — manual position

Tips

ListView Display

Scrollable list of strings with row selection. Click to select rows; use the mouse wheel or scrollbar to navigate long lists.

new ListView(opts)

Options

OptionTypeDefaultDescription
x, ynumber0, 0Canvas position of the panel's top-left corner.
widthnumber280Panel width in pixels.
heightnumber200Panel height in pixels.
fontSizenumber12Text size in pixels. Row height is computed as fontSize × 1.6.
paddingnumber8Padding from the panel edges in pixels.
itemsarray[]Array of strings to display. Trigger re-render by reassigning (e.g., lv.items = newList).
onSelectfunctionnullonSelect({item, index}[, control]) — called when a row is clicked.
onReleasefunctionnullonRelease({item, index}[, control]) — called on mouse/touch release after a row click.

Properties

PropertyDescription
.itemsGet/set the array of strings. Resets scroll and selection when assigned.
.selectedIdxGet/set the index of the selected row (−1 = none). Clamped to valid range and scrolls into view.
.scrollYGet/set the vertical scroll offset in pixels. Automatically clamped to the valid range.

Interaction

GestureEffect
ClickSelect the row under the mouse. Fires onSelect callback.
HoverHighlight the row under the mouse with a subtle tint.
Mouse wheelScroll vertically. Scrollbar appears when content overflows the panel height.
Scrollbar dragDrag the scrollbar thumb to navigate quickly.

Example

GridView Display

Scrollable table with column headers and auto-sized columns. Row selection on click; vertical scroll with the mouse wheel; horizontal scroll via the bottom scrollbar when content is wider than the panel.

new GridView(opts)

Options

OptionTypeDefaultDescription
x, ynumber0, 0Canvas position of the panel's top-left corner.
widthnumber400Panel width in pixels.
heightnumber220Panel height in pixels.
fontSizenumber12Text size in pixels. Header height is fontSize × 1.8; row height is fontSize × 1.6.
paddingnumber8Padding from the panel edges and between cells in pixels.
itemsarray[]Array of objects. All items must have the same keys. Column names and widths are derived from the first object. Assign to trigger re-render.
onSelectfunctionnullonSelect({item, index}[, control]) — called when a row is clicked. item is the row object.
onReleasefunctionnullonRelease({item, index}[, control]) — called on mouse/touch release after a row click.

Features

Properties

PropertyDescription
.itemsGet/set the array of objects. Resets scroll and selection when assigned. Column widths are recomputed on first draw.
.selectedIdxGet/set the index of the selected row (−1 = none). Clamped to valid range and scrolls into view.
.scrollYGet/set the vertical scroll offset in pixels. Automatically clamped to the valid range.
.scrollXGet/set the horizontal scroll offset in pixels. Automatically clamped to the valid range.

Interaction

GestureEffect
ClickSelect the row under the mouse. Fires onSelect callback.
HoverHighlight the row under the mouse with a subtle tint.
Mouse wheelScroll vertically (main data rows). The header stays fixed.
Vertical scrollbarDrag to scroll rows up/down. Appears on the right when data overflows vertically.
Horizontal scrollbarDrag to scroll columns left/right. Appears at the bottom when data overflows horizontally. The header scrolls in sync.

Example

HeatMapView Display

Multidimensional treemap with drill-down navigation. Visualize hierarchical data by grouping and summing a numeric field across dimension levels. Cell size is driven by areaMetric. An optional colorMetric maps a second field to a color gradient (e.g. red → gray → green for negative / flat / positive change). Click cells to explore deeper levels; use breadcrumbs or right-click to navigate back.

new HeatMapView(opts)

Options

OptionTypeDefaultDescription
x, ynumber0, 0Canvas position of the panel's top-left corner.
widthnumber400Panel width in pixels.
heightnumber280Panel height in pixels.
fontSizenumber12Text size in pixels. Breadcrumb height is fontSize × 1.8.
paddingnumber8Padding from the panel edges in pixels.
fieldsarray[]Array of field names defining the drill-down hierarchy. E.g., ['product', 'brand', 'trim'].
areaMetricstringnullField to sum for cell sizing. E.g., 'quantity' or 'revenue'. (valueField is accepted as an alias for backwards compatibility.)
colorMetricstringnullOptional field to sum for cell color. Values are mapped across colorRange — useful for showing change or performance alongside size.
colorRangestring[]nullColor stops for the colorMetric gradient. Any number of CSS color strings, lerped between stops. E.g., ['red','gray','green'] maps min → red, midpoint → gray, max → green.
itemsarray[]Array of objects with keys matching fields, areaMetric, and optionally colorMetric. Trigger re-render by reassigning (e.g., hm.items = newData).
onSelectfunctionnullonSelect({path, value, items}[, control]) — called when clicking a leaf-level cell. path is an array of values drilled to, value is the sum, items are matching raw rows.

Properties

PropertyDescription
.itemsGet/set the array of data objects. Resets drill path and all state when assigned.

Interaction

GestureEffect
Click cellIf not at the deepest level, drill down to show sub-groups. If at deepest level, select the cell and fire onSelect callback.
Right-clickPop back one drill level. Disabled at root level.
Click breadcrumbJump directly to any drill depth (e.g., click "cars" in "All › cars › ford" to jump back to the product level).
HoverCell borders highlight with theme.hoverGlow. Selected cells show theme.capIndicator border.

Example

Dow Jones Market Cap Example

Explore market data organized by industry sector and company: