UI components
  1. Start here
  2. API typings
  3. Audio processing
  4. PluginAPI
  5. UI components
    1. JSX and rendering
    2. Using components
    3. Controls
    4. Curves and envelopes
    5. Canvas
    6. Menus
    7. Presets
    8. Asset browsers
    9. Text and input
    10. Layout and HTML tags
    11. AI chat
    12. Icons
    13. Audio displays
    14. Style system
  6. Assets
  7. AI

UI components

Everything a plugin's window can show: how render() becomes a UI, every component with a checked example and its props, and the style system.

JSX and rendering

render(api) returns JSX: a tree of HTML-like tags and components. It runs again whenever a parameter, this.state or this.daw changes, and only what changed is redrawn. A built plugin compiles the tree into native drawing code, and the browser preview draws it with the same renderer, so the window looks the same in both, except where an entry below says otherwise.

A render tree
import { Knob, Button } from '@the-plug/ui';

<div style={{ display: 'flex', flexDirection: 'column', gap: 16, padding: 24, backgroundColor: '#16161d' }}>
  <h1 style={{ color: '#f2f2f2', fontSize: 18 }}>Drive</h1>
  <div style={{ display: 'flex', gap: 24, alignItems: 'center' }}>
    <Knob value={this.getParam('drive')} onChange={(v) => this.setParam('drive', v)} label="Drive" size={64} />
    <Knob value={this.getParam('mix')} onChange={(v) => this.setParam('mix', v)} label="Mix" size={64} />
    <Button label="Bypass" active={this.getParam('mode') === 1} onClick={() => this.setParam('mode', 1 - this.getParam('mode'))} />
  </div>
</div>

Tags take style, onClick, onDoubleClick, onPointerDown, onPointerMove, onPointerUp and onWheel. Layout and HTML tags lists what each tag becomes.

Using components

Import components from @the-plug/ui, or from their module for the audio displays. Their props are typed, so a misspelt prop or a wrong value is an error in the editor before you build. Five are the exception for now: View, Text, TextField, Label and Dropdown accept any prop without a word, so check their tables. A control is bound to a parameter through value and onChange, with this.getParam and this.setParam.

Every example below compiles against the typings the builder uses. Every prop table is generated from the component's own source, so it lists exactly the props the component has.

Controls

The controls a player reaches for: knobs, faders, buttons and pads.

<Knob>@the-plug/ui

A rotary control. Drawn with Canvas 2D; a layer with a shader draws that knob on the GPU.

import { Knob } from '@the-plug/ui';

<Knob
  value={this.getParam('drive')}
  onChange={(v) => this.setParam('drive', v)}
  label="Drive"
  size={64}
  param="drive"
  layers={[
    { primitive: { type: 'Circle', width: 56, color: '#1d1d24' } },
    { primitive: { type: 'Circle', width: 8, color: '#ff6a00' }, effects: { offsetY: -20 }, valueToRotation: true },
  ]}
/>
  • sensitivity is the pixels of vertical drag that sweep the whole range; the default is the knob's height.
  • valueToRotation turns a layer from -135 to +135 degrees with the value, the classic pointer sweep.
  • Artwork goes on a layer as { primitive: { type: 'Image', src: './assets/knob-face.png' } }, with the path written as for <img>. A film strip adds frames (its cell count) and strip ('vertical' or 'horizontal'), and the value picks the cell.
  • param names the parameter the knob drives, so a right-click offers Automate and Reset: from the host in a built plugin, from the browser preview's own menu in the builder.
PropTypeDefaultDescription
xnumberX position in pixels.
ynumberY position in pixels (see x).
minnumber0Minimum value (used for value->frame mapping)
maxnumber1Maximum value (used for value->frame mapping)
sizenumber100Knob size in pixels (width and height)
valuerequirednumberCurrent value (range is defined by min/max)
onChange(value: number) => voidChange handler
labelstringLabel text (optional)
sensitivitynumberthe knob's heightPixels of vertical drag that carry the knob through its whole range.
defaultValuenumberThe value a double-click puts the knob back to, in the knob's min..max units like `value`; a drag that goes on from that press starts there.
stepnumbera hundredth of the range, or of the sweep for a knob given a 'log' or 'exp' `taper`How far one notch of a mouse wheel over the knob moves it, in its min..max units; with Shift held, a tenth of that.
readoutTextstringThe text the knob's readout shows while it is dragged: a small box above it (below it at the top of the window), from the press to the release, in both runtimes (ControlReadout.h).
hideReadoutbooleanfalseHide the readout a drag shows, for a knob that shows its value itself (a value printed under it).
taper'linear' | 'log' | 'exp''linear'The curve between the knob's value and its place on its sweep, as a parameter's `taper` is: 'log' puts the middle of a 20..20000 Hz knob at 632 Hz, 'exp' with `skew` 2 the middle of 0..500 ms at 125.
skewnumber1The exponent of an 'exp' taper: value = min + (max - min) · position^skew.
framesnumber100Number of frames in knob animation
layersEnhancedLayerConfig[]Knob layer definition (passed through to the native knob renderer).
stylePluginComponentStyleOptions | 'default' | 'minimal' | 'vintage'Either a rich inline style object (with `:hovered`/`:active`/`:disabled` pseudo-selector keys) or a variant preset name.
colorstringAccent color (CSS color or hex)
disabledbooleanDisabled state
paramstring
contextMenuContextMenuItem[]
contextMenuStyleContextMenuStyle
nativeContextMenuContextMenuItem[]

<Slider>@the-plug/ui

A linear fader, horizontal or vertical. x and y are required.

import { Slider } from '@the-plug/ui';

<Slider
  x={0}
  y={0}
  width={180}
  value={this.getParam('mix')}
  onChange={(v) => this.setParam('mix', v)}
  label="Mix"
  showValue
  trackColor="#2a2a33"
  thumbColor="#ff6a00"
/>
  • trackColor and thumbColor are props of their own. Inside style they are dropped, with a warning at build time.
  • In a built plugin style sets only backgroundColor, borderColor, borderWidth and borderRadius.
PropTypeDefaultDescription
xrequirednumberX position in pixels.
yrequirednumberY position in pixels (see x).
widthnumber200Width in pixels
heightnumber20Height in pixels (for vertical sliders)
orientation'horizontal' | 'vertical''horizontal'Orientation
valuerequirednumberCurrent value (0.0 - 1.0 normalized, or actual value when min/max are set)
minnumberMinimum value (optional — when set, value/onChange use actual range instead of 0-1)
maxnumberMaximum value (optional — when set, value/onChange use actual range instead of 0-1)
onChange(value: number) => voidChange handler
defaultValuenumberThe value a double-click puts the slider back to, in the same units as `value`; a drag that goes on from that press starts there.
stepnumbera hundredth of the rangeHow far one notch of a mouse wheel over the slider moves it, in the same units as `value`; with Shift held, a tenth of that.
labelstringLabel text (optional)
showValuebooleanShow value as text, beside the slider at all times.
readoutTextstringThe text the slider's readout shows while it is dragged: a small box above it (below it at the top of the window), from the press to the release, in both runtimes (ControlReadout.h).
hideReadoutbooleanfalseHide the readout a drag shows, for a slider that shows its value itself (`showValue`, or a readout of its own).
disabledbooleanDisabled state
contextMenuContextMenuItem[]Context menu items shown on right-click.
trackColorstringTrack colour (any CSS colour).
thumbColorstringThumb / handle colour (any CSS colour).
stylePluginComponentStyleOptionsVisual styling.

<Button>@the-plug/ui

A click or toggle button. Its children can be text or icons.

import { Button } from '@the-plug/ui';

<Button label="Bypass" active={this.getParam('mode') === 1} onClick={() => this.setParam('mode', 1 - this.getParam('mode'))} style="primary" />
  • Colours and borders go in style. Writing color="red" on a Button is a type error whose message says so.
PropTypeDefaultDescription
xnumberX position in pixels.
ynumberY position in pixels (see x).
titlestringTooltip text shown on hover (lowered to the node's title prop).
widthnumberWidth in pixels (optional — derived from text content + padding when omitted)
heightnumberHeight in pixels (optional — derived from text content + padding when omitted)
labelstringButton label text.
childrenanyChildren (typically text).
onClick() => voidClick handler
activebooleanButton state (for toggle buttons)
stylePluginComponentStyleOptions | 'default' | 'primary' | 'danger'Either a rich inline style object (with `:hovered`/`:active`/`:disabled` pseudo-selector keys) or a variant preset name.
disabledbooleanDisabled state
contextMenuContextMenuItem[]Context menu items shown on right-click.

<XYPad>@the-plug/ui

A square pad that moves two values at once.

import { XYPad } from '@the-plug/ui';

<XYPad
  valueX={this.getParam('cutoff')}
  valueY={this.getParam('resonance')}
  onChangeX={(v) => this.setParam('cutoff', v)}
  onChangeY={(v) => this.setParam('resonance', v)}
  labelX="Cutoff"
  labelY="Resonance"
/>
PropTypeDefaultDescription
widthnumber160Canvas width in pixels
heightnumber160Canvas height in pixels
valueXrequirednumberX-axis value (0-1)
valueYrequirednumberY-axis value (0-1, bottom=0, top=1)
onChangeX(v: number) => voidCalled when X changes
onChangeY(v: number) => voidCalled when Y changes
labelXstring''X axis label
labelYstring''Y axis label
cornerLabel0stringTop-left corner label
cornerLabel1stringTop-right corner label
cornerLabel2stringBottom-left corner label
cornerLabel3stringBottom-right corner label
colorstring'#00e5ff'Accent color
gridLinesnumber4Grid line count per axis
styleRecord<string, any>Additional styles

<ToggleArrow>@the-plug/ui

A disclosure arrow. It only draws open or closed; put it inside something you can click.

import { ToggleArrow } from '@the-plug/ui';

<div onClick={() => { open = !open; }} style={{ display: 'flex', gap: 6 }}>
  <ToggleArrow expanded={open} />
  <span>Advanced</span>
</div>
PropTypeDefaultDescription
expandedbooleanfalseWhether the section is expanded.
widthnumber16Canvas width in pixels.
heightnumber16Canvas height in pixels.
dimbooleanfalseUse dimmer color for sub-section indicators.
arrowScalenumber0.5Arrow size as fraction of canvas (0-1).

<ColorPicker>@the-plug/ui

A colour swatch that opens a picker.

import { ColorPicker } from '@the-plug/ui';

<ColorPicker value="#ff6a00" showAlpha={false} onChange={(e) => console.log(e.hex)} />
PropTypeDefaultDescription
valueColorValueCurrent color — hex string or RGBA object.
onChange(event: ColorPickerChangeEvent) => voidFired whenever the user picks a new color.
swatchWidthnumber32Swatch preview width in pixels.
swatchHeightnumber32Swatch preview height in pixels.
showAlphabooleantrueShow alpha slider.

<ResizeGrip>@the-plug/ui

A corner grip that resizes the editor by asking the host. It is the only way to resize in Pro Tools.

import { ResizeGrip } from '@the-plug/ui';

<ResizeGrip api={api} />
  • The plugin must declare static resizable = true; a fixed-size editor refuses the request.
PropTypeDefaultDescription
apirequiredPluginAPI<any>The plugin's API — the `api` its render() receives: the grip reads the editor's size from it when a drag begins and asks it for each size while the drag goes on.
colorstring'#8a8a99'Stroke colour of the grip lines.
styleRecord<string, any>Styles for the box the grip sits in — place it in the editor's bottom-right corner.

Curves and envelopes

Editors for drawn shapes: transfer curves, envelopes and other lines a player bends by hand.

<CurveEditor2D>@the-plug/ui

A curve and envelope editor drawn with Canvas 2D: per-point curve types and tension, snapping, zoom, menus. Use it unless you need the GPU effects.

import { CurveEditor2D } from '@the-plug/ui';

<CurveEditor2D
  width={360}
  height={160}
  points={points}
  pointsKey={pointsKey}
  onPointsChanged={(next) => console.log(next.length, 'points')}
  snap={1}
  snapX={8}
  snapY={4}
  curveR={1}
  curveG={0.42}
  curveB={0}
/>
  • Colours are 0 to 1 red, green and blue props (curveR, curveG, curveB); switches such as snap are 0 or 1.
  • Change pointsKey whenever you replace points from outside, or the editor keeps its own.
  • Right-click menus are numbered slots (pointMenuCount, pointMenuItem0 to pointMenuItem7), because a built plugin reads an absent prop as 0 or an empty string.
All 192 props of CurveEditor2D
PropTypeDefaultDescription
pointsArray<{ x: number; y: number; curveType?: number; tension?: number; lockX?: number; lockY?: number; }>External point array, as the GPU editor's — and a point may carry its own curveType and tension, which this editor takes over the curve mode when present (componentDidUpdate's sync).
onPointWheel(index: number, deltaY: number, shiftKey: boolean, ctrlKey: boolean, altKey: boolean) => voidWheel over a point.
onHoverChanged(index: number) => voidThe hovered point changed (-1 = none).
onPointReset(index: number) => voidWhen set, a right-clicked point's context menu gains a "Reset point" item that calls this with the point's index.
pointMenuCountnumberUp to eight extra items for a right-clicked point's menu, as SCALAR labels; an empty one is skipped.
pointMenuItem0string
pointMenuItem1string
pointMenuItem2string
pointMenuItem3string
pointMenuItem4string
pointMenuItem5string
pointMenuItem6string
pointMenuItem7string
onPointMenuAction(index: number, itemIndex: number) => voidWhich extra item was picked, for the point the menu was opened on.
fixedCurvesnumber01: every segment's curve type and tension are the host's, passed in `points` — the menu offers no curve type, tension or "Set All Segments" items, and Alt+wheel bends nothing, so the picture shows only what the host gave it (ADSREnvelope's exact mode, where the curves are a synth's parameters).
onSegmentBend(index: number, tension: number) => voidGiven, a press on an Exponential (mode 9) segment, within 10 px of its curve and away from its points, bends it: as the pointer moves, the segment's tension becomes its tension at the press less twice the move along the segment's rise as a share of that rise, held to -1..1 — so a drag toward the segment's end draws its middle toward that end, as in Serum.
pointOutlineWidthnumber0Outline width around each control point in pixels (0 = off).
pointOutlineRnumber0Point outline color R
pointOutlineGnumber0Point outline color G
pointOutlineBnumber0Point outline color B
markerSegmentnumberA dot on the curve where something is along it, such as a voice along its envelope: on segment `markerSegment` (0 runs from point 0 to point 1; -1, the default, draws none), `markerAlong` of the way, 0..1, measured in the segment's own rise: the place where the curve has gone that share of the way from its start height to its end height, so the dot sits on the curve as drawn, whatever its shape.
markerAlongnumber
widthnumber400Canvas width in pixels.
heightnumber200Canvas height in pixels.
curveModenumber | 'linear' | 'smooth' | 'step' | 'hold'1Interpolation mode (sent as int to shader). 0 | 'linear' — straight lines 1 | 'smooth' — catmull-rom spline 2 | 'step' — instant jump 3 | 'hold' — hold previous value
gridXnumber8Vertical grid divisions. 0 = no grid.
gridYnumber4Horizontal grid divisions. 0 = no grid.
gridOpacitynumber0.15Grid line opacity (0–1).
gridColorRnumber0.25Grid line color R 0-1
gridColorGnumber0.25Grid line color G 0-1
gridColorBnumber0.25Grid line color B 0-1
bgGradTopRnumber0.12BG gradient top color R
bgGradTopGnumber0.12BG gradient top color G
bgGradTopBnumber0.12BG gradient top color B
bgGradBotRnumber0.08BG gradient bottom color R
bgGradBotGnumber0.08BG gradient bottom color G
bgGradBotBnumber0.08BG gradient bottom color B
curveRnumber1.0Curve color R
curveGnumber1.0Curve color G
curveBnumber1.0Curve color B
curveWidthnumber1.5Curve line thickness in pixels.
curveGradientnumber0Enable gradient from curveGradStart → curveGradEnd based on Y.
curveGradStartRnumber1.0Gradient start R (at Y=0)
curveGradStartGnumber0.2Gradient start G
curveGradStartBnumber0.4Gradient start B
curveGradEndRnumber0.2Gradient end R (at Y=1)
curveGradEndGnumber0.6Gradient end G
curveGradEndBnumber1.0Gradient end B
glowIntensitynumber0Glow intensity around the curve (0 = off).
glowRadiusnumber0Glow falloff radius in pixels.
glowRnumbersame as curveRGlow color R
glowGnumbersame as curveGGlow color G
glowBnumbersame as curveBGlow color B
fillOpacitynumber0Fill opacity under the curve (0 = off).
pointSizenumber4.0Point radius in pixels.
pointRnumber1.0Point color R
pointGnumber1.0Point color G
pointBnumber1.0Point color B
pointGlownumber0Point glow intensity (0 = off).
pointGlowRnumbersame as curveRPoint glow color R
pointGlowGnumbersame as curveGPoint glow color G
pointGlowBnumbersame as curveBPoint glow color B
readOnlybooleanfalseRead-only mode.
minPointsnumber2Minimum number of points.
disableTensionnumber0Disable per-point tension adjustment.
disableExtendedCurveTypesnumber0Disable per-point curve type switching beyond the default `curveMode` (linear/smooth/step).
useNativeContextMenuboolean | numberfalse (custom overlay)Use OS-native context menu (NSMenu/Win32) instead of custom overlay.
zoomDisablednumber0 (enabled)Disable zoom (Cmd/Ctrl + scroll).
panDisablednumber0 (enabled)Disable pan (scroll, Shift+scroll, middle-drag).
minXnumber0Minimum X value (domain start).
maxXnumber1Maximum X value (domain end).
minYnumber0Minimum Y value (range start).
maxYnumber1Maximum Y value (range end).
shadowOpacitynumber0Curve shadow opacity (0 = off).
shadowOffsetXnumber2Shadow offset X in pixels.
shadowOffsetYnumber2Shadow offset Y in pixels.
shadowBlurnumber4Shadow blur radius.
shadowRnumber0Shadow color R
shadowGnumber0Shadow color G
shadowBnumber0Shadow color B
embossStrengthnumber0Emboss strength (0 = off).
embossHighRnumber1Emboss highlight color R
embossHighGnumber1Emboss highlight color G
embossHighBnumber1Emboss highlight color B
embossShadowRnumber0Emboss shadow color R
embossShadowGnumber0Emboss shadow color G
embossShadowBnumber0Emboss shadow color B
embossAnglenumber135Emboss light angle in degrees
metallicIntensitynumber0Metallic shine intensity (0 = off).
metallicSizenumber0.3Metallic specular size (0-1).
metallicRnumber0.7Metallic base color R
metallicGnumber0.7Metallic base color G
metallicBnumber0.8Metallic base color B
woodGrainnumber0Wood grain intensity (0 = off).
woodBaseRnumber0.4Wood base color R
woodBaseGnumber0.26Wood base color G
woodBaseBnumber0.13Wood base color B
woodGrainRnumber0.3Wood grain color R
woodGrainGnumber0.18Wood grain color G
woodGrainBnumber0.08Wood grain color B
woodScalenumber20Wood grain scale
noiseIntensitynumber0Noise texture intensity (0 = off).
noiseScalenumber50Noise scale/frequency
noiseMononumber1Noise is monochrome (1) or colored (0).
innerGlowIntensitynumber0Inner glow intensity (0 = off).
innerGlowRnumber1Inner glow color R
innerGlowGnumber1Inner glow color G
innerGlowBnumber1Inner glow color B
innerGlowRadiusnumber10Inner glow radius
outlineWidthnumber0Outer outline width (0 = off).
outlineRnumber0Outline color R
outlineGnumber0Outline color G
outlineBnumber0Outline color B
scanlineIntensitynumber0Scanline intensity (0 = off).
scanlineSpacingnumber2Scanline spacing in pixels
scanlineAnglenumber0Scanline angle in degrees (0=horizontal)
fillGradientModenumber0Fill gradient mode: 0=solid, 1=vertical, 2=horizontal, 3=radial
fillGradStartRnumbersame as curveRFill gradient start color R
fillGradStartGnumbersame as curveGFill gradient start G
fillGradStartBnumbersame as curveBFill gradient start B
fillGradEndRnumber0Fill gradient end color R
fillGradEndGnumber0Fill gradient end G
fillGradEndBnumber0Fill gradient end B
borderWidthnumber0Border width around canvas (0 = off).
borderRnumber0.3Border color R
borderGnumber0.3Border color G
borderBnumber0.3Border color B
borderRadiusnumber0Border corner radius
vignetteIntensitynumber0Vignette intensity (0 = off).
vignetteSizenumber0.5Vignette size (0-1).
vignetteSoftnessnumber0.5Vignette softness
pointStylenumber0Control point shape. 0 = filled circle (default), 1 = ring/hollow, 2 = square, 3 = diamond
curveAlphanumber1.0Curve line opacity (0–1).
gridStylenumber0Grid line rendering style. 0 = solid (default), 1 = dashed, 2 = dotted
bgFlatnumber0Use flat color instead of gradient (1 = flat, uses bgGradTop).
fillPositionnumber0Fill area: 0 = below curve (default), 1 = above curve.
dynBgSpeednumber1.0Dynamic bg animation speed multiplier.
dynBgIntensitynumber0.5Dynamic bg intensity / blend amount (0-1).
dynBgScalenumber1.0Dynamic bg scale / zoom factor.
dynBgColor1Rnumber0.2Dynamic bg primary color R
dynBgColor1Gnumber0.5Dynamic bg primary color G
dynBgColor1Bnumber1.0Dynamic bg primary color B
dynBgColor2Rnumber1.0Dynamic bg secondary color R
dynBgColor2Gnumber0.2Dynamic bg secondary color G
dynBgColor2Bnumber0.5Dynamic bg secondary color B
dynBgColor3Rnumber0.0Dynamic bg tertiary color R
dynBgColor3Gnumber1.0Dynamic bg tertiary color G
dynBgColor3Bnumber0.5Dynamic bg tertiary color B
dynBgDistortnumber0.0Dynamic bg distortion / warp amount.
dynBgComplexitynumber3.0Dynamic bg complexity / octaves.
dynBgShaderstring | ICurveEditorShaderWGSL shader body for the dynamic background.
dynBgReactStrengthnumber0.6Strength of the reactive effect.
dynBgReactRadiusnumber0.25Radius of influence around each point (normalised).
dynBgReactDecaynumber2.0How quickly effect fades with distance.
dynBgReactColor1Rnumber0.0Reactive colour 1 R.
dynBgReactColor1Gnumber0.5Reactive colour 1 G.
dynBgReactColor1Bnumber1.0Reactive colour 1 B.
dynBgReactColor2Rnumber1.0Reactive colour 2 R.
dynBgReactColor2Gnumber0.3Reactive colour 2 G.
dynBgReactColor2Bnumber0.5Reactive colour 2 B.
dynBgReactSmoothnumber0.5Smoothing / blend factor for reactive effect.
dynBgReactFreqnumber4.0Frequency / detail of reactive pattern.
dynBgReactPhasenumber0.0Phase offset for timing.
dynBgReactShaderstring | ICurveEditorShaderWGSL shader body for the reactive background.
dynBgDatanumber[]Per-frame floats for the background shaders, read in WGSL as getData(i) with getDataCount() entries: a spectrum, a meter history, a sampled response curve.
dynBgDataCountnumber0How many entries of dynBgData are valid.
playheadXnumber-1Playhead X position (0-1 in curve space).
playheadRnumber1.0Playhead color R
playheadGnumber1.0Playhead color G
playheadBnumber1.0Playhead color B
playheadAlphanumber0.8Playhead opacity (0-1).
playheadWidthnumber2Playhead line width in pixels.
pointsKeynumberKey to detect when external points change.
snapnumber0Enable snap-to-grid (0=off, 1=on).
snapXnumber8Snap X divisions (e.g. 8 = snap to 1/8 increments).
snapYnumber4Snap Y divisions (e.g. 4 = snap to 1/4 increments).
staticPointsnumber0Static points mode (0=off, 1=on).
pointsIndependentnumber0The points are THINGS, not the knots of a curve.
renderBackground(ctx: CanvasRenderingContext2D, width: number, height: number) => voidCustom background render callback.
animatebooleanDeclare this editor's shader background ANIMATED OVER TIME — forwarded to `<Canvas animate>`, and the only thing that feeds the frame clock `t` to `dynBgShader` / `dynBgReactShader`.
pointColorsArray<{ r: number; g: number; b: number; }>Per-point color overrides.
onPointsChanged(points: Array<{ x: number; y: number; lockX?: number; lockY?: number; }>) => voidCalled when points change (add, delete, drag).
bgMenuCountnumber0Items for a right-click that lands on NO point — the editor's background.
bgMenuItem0string
bgMenuItem1string
bgMenuItem2string
bgMenuItem3string
onBgMenuAction(itemIndex: number) => voidChosen item from the background menu.
bgColorstringBackground color (hex string like '#1a0a0a').
curveColorstringCurve color (hex string).
gridColorstringGrid color (hex string).
pointColorstringPoint color (hex string).

<CurveEditorGPU>@the-plug/ui

The same editor drawn with WebGPU, with shader effects: glow, emboss, metal, wood, noise, scanlines, a shader background and a playhead.

import { CurveEditorGPU } from '@the-plug/ui';

<CurveEditorGPU
  width={420}
  height={180}
  points={points}
  pointsKey={pointsKey}
  onPointsChanged={(next) => console.log(next.length, 'points')}
  glowIntensity={0.6}
  glowRadius={8}
  fillOpacity={0.2}
  playheadX={0.25}
/>
  • A plugin that uses it needs WebGPU; the build records that for you.
  • animate must be written as true or false, not computed.
  • The hex shorthands bgColor, curveColor, gridColor and pointColor work in the browser preview only. In a built plugin, set the red, green and blue props.
All 184 props of CurveEditorGPU
PropTypeDefaultDescription
widthnumber400Canvas width in pixels.
heightnumber200Canvas height in pixels.
curveModenumber | 'linear' | 'smooth' | 'step' | 'hold'1Interpolation mode (sent as int to shader). 0 | 'linear' — straight lines 1 | 'smooth' — catmull-rom spline 2 | 'step' — instant jump 3 | 'hold' — hold previous value
gridXnumber8Vertical grid divisions. 0 = no grid.
gridYnumber4Horizontal grid divisions. 0 = no grid.
gridOpacitynumber0.15Grid line opacity (0–1).
gridColorRnumber0.25Grid line color R 0-1
gridColorGnumber0.25Grid line color G 0-1
gridColorBnumber0.25Grid line color B 0-1
bgGradTopRnumber0.12BG gradient top color R
bgGradTopGnumber0.12BG gradient top color G
bgGradTopBnumber0.12BG gradient top color B
bgGradBotRnumber0.08BG gradient bottom color R
bgGradBotGnumber0.08BG gradient bottom color G
bgGradBotBnumber0.08BG gradient bottom color B
curveRnumber1.0Curve color R
curveGnumber1.0Curve color G
curveBnumber1.0Curve color B
curveWidthnumber1.5Curve line thickness in pixels.
curveGradientnumber0Enable gradient from curveGradStart → curveGradEnd based on Y.
curveGradStartRnumber1.0Gradient start R (at Y=0)
curveGradStartGnumber0.2Gradient start G
curveGradStartBnumber0.4Gradient start B
curveGradEndRnumber0.2Gradient end R (at Y=1)
curveGradEndGnumber0.6Gradient end G
curveGradEndBnumber1.0Gradient end B
glowIntensitynumber0Glow intensity around the curve (0 = off).
glowRadiusnumber0Glow falloff radius in pixels.
glowRnumbersame as curveRGlow color R
glowGnumbersame as curveGGlow color G
glowBnumbersame as curveBGlow color B
fillOpacitynumber0Fill opacity under the curve (0 = off).
pointSizenumber4.0Point radius in pixels.
pointRnumber1.0Point color R
pointGnumber1.0Point color G
pointBnumber1.0Point color B
pointGlownumber0Point glow intensity (0 = off).
pointGlowRnumbersame as curveRPoint glow color R
pointGlowGnumbersame as curveGPoint glow color G
pointGlowBnumbersame as curveBPoint glow color B
readOnlybooleanfalseRead-only mode.
minPointsnumber2Minimum number of points.
disableTensionnumber0Disable per-point tension adjustment.
disableExtendedCurveTypesnumber0Disable per-point curve type switching beyond the default `curveMode` (linear/smooth/step).
useNativeContextMenuboolean | numberfalse (custom overlay)Use OS-native context menu (NSMenu/Win32) instead of custom overlay.
zoomDisablednumber0 (enabled)Disable zoom (Cmd/Ctrl + scroll).
panDisablednumber0 (enabled)Disable pan (scroll, Shift+scroll, middle-drag).
minXnumber0Minimum X value (domain start).
maxXnumber1Maximum X value (domain end).
minYnumber0Minimum Y value (range start).
maxYnumber1Maximum Y value (range end).
shadowOpacitynumber0Curve shadow opacity (0 = off).
shadowOffsetXnumber2Shadow offset X in pixels.
shadowOffsetYnumber2Shadow offset Y in pixels.
shadowBlurnumber4Shadow blur radius.
shadowRnumber0Shadow color R
shadowGnumber0Shadow color G
shadowBnumber0Shadow color B
embossStrengthnumber0Emboss strength (0 = off).
embossHighRnumber1Emboss highlight color R
embossHighGnumber1Emboss highlight color G
embossHighBnumber1Emboss highlight color B
embossShadowRnumber0Emboss shadow color R
embossShadowGnumber0Emboss shadow color G
embossShadowBnumber0Emboss shadow color B
embossAnglenumber135Emboss light angle in degrees
metallicIntensitynumber0Metallic shine intensity (0 = off).
metallicSizenumber0.3Metallic specular size (0-1).
metallicRnumber0.7Metallic base color R
metallicGnumber0.7Metallic base color G
metallicBnumber0.8Metallic base color B
woodGrainnumber0Wood grain intensity (0 = off).
woodBaseRnumber0.4Wood base color R
woodBaseGnumber0.26Wood base color G
woodBaseBnumber0.13Wood base color B
woodGrainRnumber0.3Wood grain color R
woodGrainGnumber0.18Wood grain color G
woodGrainBnumber0.08Wood grain color B
woodScalenumber20Wood grain scale
noiseIntensitynumber0Noise texture intensity (0 = off).
noiseScalenumber50Noise scale/frequency
noiseMononumber1Noise is monochrome (1) or colored (0).
innerGlowIntensitynumber0Inner glow intensity (0 = off).
innerGlowRnumber1Inner glow color R
innerGlowGnumber1Inner glow color G
innerGlowBnumber1Inner glow color B
innerGlowRadiusnumber10Inner glow radius
outlineWidthnumber0Outer outline width (0 = off).
outlineRnumber0Outline color R
outlineGnumber0Outline color G
outlineBnumber0Outline color B
scanlineIntensitynumber0Scanline intensity (0 = off).
scanlineSpacingnumber2Scanline spacing in pixels
scanlineAnglenumber0Scanline angle in degrees (0=horizontal)
fillGradientModenumber0Fill gradient mode: 0=solid, 1=vertical, 2=horizontal, 3=radial
fillGradStartRnumbersame as curveRFill gradient start color R
fillGradStartGnumbersame as curveGFill gradient start G
fillGradStartBnumbersame as curveBFill gradient start B
fillGradEndRnumber0Fill gradient end color R
fillGradEndGnumber0Fill gradient end G
fillGradEndBnumber0Fill gradient end B
borderWidthnumber0Border width around canvas (0 = off).
borderRnumber0.3Border color R
borderGnumber0.3Border color G
borderBnumber0.3Border color B
borderRadiusnumber0Border corner radius
vignetteIntensitynumber0Vignette intensity (0 = off).
vignetteSizenumber0.5Vignette size (0-1).
vignetteSoftnessnumber0.5Vignette softness
pointStylenumber0Control point shape. 0 = filled circle (default), 1 = ring/hollow, 2 = square, 3 = diamond
curveAlphanumber1.0Curve line opacity (0–1).
gridStylenumber0Grid line rendering style. 0 = solid (default), 1 = dashed, 2 = dotted
bgFlatnumber0Use flat color instead of gradient (1 = flat, uses bgGradTop).
fillPositionnumber0Fill area: 0 = below curve (default), 1 = above curve.
dynBgSpeednumber1.0Dynamic bg animation speed multiplier.
dynBgIntensitynumber0.5Dynamic bg intensity / blend amount (0-1).
dynBgScalenumber1.0Dynamic bg scale / zoom factor.
dynBgColor1Rnumber0.2Dynamic bg primary color R
dynBgColor1Gnumber0.5Dynamic bg primary color G
dynBgColor1Bnumber1.0Dynamic bg primary color B
dynBgColor2Rnumber1.0Dynamic bg secondary color R
dynBgColor2Gnumber0.2Dynamic bg secondary color G
dynBgColor2Bnumber0.5Dynamic bg secondary color B
dynBgColor3Rnumber0.0Dynamic bg tertiary color R
dynBgColor3Gnumber1.0Dynamic bg tertiary color G
dynBgColor3Bnumber0.5Dynamic bg tertiary color B
dynBgDistortnumber0.0Dynamic bg distortion / warp amount.
dynBgComplexitynumber3.0Dynamic bg complexity / octaves.
dynBgShaderstring | ICurveEditorShaderWGSL shader body for the dynamic background.
dynBgReactStrengthnumber0.6Strength of the reactive effect.
dynBgReactRadiusnumber0.25Radius of influence around each point (normalised).
dynBgReactDecaynumber2.0How quickly effect fades with distance.
dynBgReactColor1Rnumber0.0Reactive colour 1 R.
dynBgReactColor1Gnumber0.5Reactive colour 1 G.
dynBgReactColor1Bnumber1.0Reactive colour 1 B.
dynBgReactColor2Rnumber1.0Reactive colour 2 R.
dynBgReactColor2Gnumber0.3Reactive colour 2 G.
dynBgReactColor2Bnumber0.5Reactive colour 2 B.
dynBgReactSmoothnumber0.5Smoothing / blend factor for reactive effect.
dynBgReactFreqnumber4.0Frequency / detail of reactive pattern.
dynBgReactPhasenumber0.0Phase offset for timing.
dynBgReactShaderstring | ICurveEditorShaderWGSL shader body for the reactive background.
dynBgDatanumber[]Per-frame floats for the background shaders, read in WGSL as getData(i) with getDataCount() entries: a spectrum, a meter history, a sampled response curve.
dynBgDataCountnumber0How many entries of dynBgData are valid.
playheadXnumber-1Playhead X position (0-1 in curve space).
playheadRnumber1.0Playhead color R
playheadGnumber1.0Playhead color G
playheadBnumber1.0Playhead color B
playheadAlphanumber0.8Playhead opacity (0-1).
playheadWidthnumber2Playhead line width in pixels.
pointsArray<{ x: number; y: number; lockX?: number; lockY?: number; }>External point array.
pointsKeynumberKey to detect when external points change.
snapnumber0Enable snap-to-grid (0=off, 1=on).
snapXnumber8Snap X divisions (e.g. 8 = snap to 1/8 increments).
snapYnumber4Snap Y divisions (e.g. 4 = snap to 1/4 increments).
staticPointsnumber0Static points mode (0=off, 1=on).
pointsIndependentnumber0The points are THINGS, not the knots of a curve.
renderBackground(ctx: CanvasRenderingContext2D, width: number, height: number) => voidCustom background render callback.
animatebooleanDeclare this editor's shader background ANIMATED OVER TIME — forwarded to `<Canvas animate>`, and the only thing that feeds the frame clock `t` to `dynBgShader` / `dynBgReactShader`.
pointColorsArray<{ r: number; g: number; b: number; }>Per-point color overrides.
onPointsChanged(points: Array<{ x: number; y: number; lockX?: number; lockY?: number; }>) => voidCalled when points change (add, delete, drag).
onPointWheel(index: number, deltaY: number, shiftKey: boolean, ctrlKey: boolean, altKey: boolean) => voidWheel over a point, handed to the plugin with the modifiers: a plugin that owns the wheel (an EQ stepping a band's Q) sets disableTension and decides itself.
onHoverChanged(index: number) => voidThe point under the pointer changed (-1 = none).
onPointReset(index: number) => voidA built-in "Reset point" item in the point's context menu; the plugin restores whatever that point stands for.
pointMenuCountnumberUp to eight extra items for a right-clicked point's menu, as SCALAR labels; an empty one is skipped.
pointMenuItem0string
pointMenuItem1string
pointMenuItem2string
pointMenuItem3string
pointMenuItem4string
pointMenuItem5string
pointMenuItem6string
pointMenuItem7string
onPointMenuAction(index: number, itemIndex: number) => voidWhich extra item was picked, for the point the menu was opened on.
bgMenuCountnumber0Items for a right-click that lands on NO point — the editor's background.
bgMenuItem0string
bgMenuItem1string
bgMenuItem2string
bgMenuItem3string
onBgMenuAction(itemIndex: number) => voidChosen item from the background menu.
bgColorstringBackground color (hex string like '#1a0a0a').
curveColorstringCurve color (hex string).
gridColorstringGrid color (hex string).
pointColorstringPoint color (hex string).

<CurveEditor>@the-plug/ui

A small Canvas 2D curve editor. It starts from four points and reads only the props below; for anything more, use CurveEditor2D.

import { CurveEditor } from '@the-plug/ui';

<CurveEditor width={320} height={140} curveMode="smooth" gridX={8} gridY={4} onChange={(points) => console.log(points.length)} />
PropTypeDefaultDescription
widthnumber400Width of the curve editor in pixels.
heightnumber200Height of the curve editor in pixels.
curveModenumber | 'linear' | 'smooth' | 'step' | 'hold'1 (smooth)Curve interpolation mode for canvas rendering.
bgColorstring'#1a1a2e'Background color for canvas rendering.
gridColorstring'#2a2a4a'Grid line color for canvas rendering.
curveColorstring'#00d4ff'Curve line color for canvas rendering.
pointColorstring'#00d4ff'Control point color for canvas rendering.
curveWidthnumber2Curve line width for canvas rendering.
pointSizenumber4Control point radius for canvas rendering.
gridXnumber8Number of major vertical grid divisions (columns).
gridYnumber4Number of major horizontal grid divisions (rows).
onChange(points: CurvePoint[]) => voidCallback when points change (user interaction).
readOnlybooleanfalseWhether the curve editor is read-only (display only).

<ADSREnvelope>@the-plug/ui

An attack, decay, sustain and release display, editable when interactive. Built on CurveEditor2D.

import { ADSREnvelope } from '@the-plug/ui';

<ADSREnvelope
  attack={env.attack}
  decay={env.decay}
  sustain={env.sustain}
  release={env.release}
  interactive
  onAttackChange={(v) => console.log('attack', v)}
  onReleaseChange={(v) => console.log('release', v)}
/>
All 54 props of ADSREnvelope
PropTypeDefaultDescription
widthnumber240Canvas width in pixels
heightnumber100Canvas height in pixels
attackrequirednumberAttack time in seconds
decayrequirednumberDecay time in seconds
sustainrequirednumberSustain level (0-1)
releaserequirednumberRelease time in seconds
minAttacknumber0.001Min attack time
maxAttacknumber2Max attack time
minDecaynumber0.001Min decay time
maxDecaynumber3Max decay time
minReleasenumber0.001Min release time
maxReleasenumber5Max release time
onAttackChange(v: number) => voidCalled when attack changes.
onDecayChange(v: number) => voidCalled when decay changes
onSustainChange(v: number) => voidCalled when sustain changes
onReleaseChange(v: number) => voidCalled when release changes
attackCurvenumberThe attack's curve, -1..1.
decayCurvenumberThe decay's curve, -1..1, as attackCurve's: 1 a natural decay, its distance to the sustain falling 60 dB over the decay's time.
releaseCurvenumberThe release's curve, -1..1, as decayCurve's, falling to silence.
onAttackCurveChange(c: number) => voidCalled with the attack's new curve, -1..1, as the attack is dragged to bend it (exact mode).
onDecayCurveChange(c: number) => voidCalled with the decay's new curve as the decay is dragged to bend it.
onReleaseCurveChange(c: number) => voidCalled with the release's new curve as the release is dragged to bend it.
interactivebooleanfalseEnable draggable breakpoints
playStagenumberWhere a voice is along the envelope, drawn as a dot on the curve (CurveEditor2D's marker): its stage, 1 attack, 2 decay, 3 sustain, 4 release (0, the default, none); its level, 0..1; and the level its release began at.
playLevelnumber
playFromnumber
styleRecord<string, any>Additional styles, for the envelope's root — over its own layout, so a value given here wins.
curveRnumber1Curve red component 0-1
curveGnumber0.7Curve green component 0-1
curveBnumber0Curve blue component 0-1
curveWidthnumber2Curve stroke width
curveAlphanumber1Curve opacity 0-1
pointRnumber1Point red component 0-1
pointGnumber0.7Point green component 0-1
pointBnumber0Point blue component 0-1
pointSizenumber5Point radius
fillOpacitynumber0.1Fill opacity under curve 0-1
bgGradTopRnumber0.05Background top red 0-1
bgGradTopGnumber0.05Background top green 0-1
bgGradTopBnumber0.12Background top blue 0-1
bgGradBotRnumber0.03Background bottom red 0-1
bgGradBotGnumber0.03Background bottom green 0-1
bgGradBotBnumber0.08Background bottom blue 0-1
glowIntensitynumber0Glow intensity 0-1
glowRadiusnumber6Glow radius
borderWidthnumber0Border width
borderRnumberBorder red 0-1
borderGnumberBorder green 0-1
borderBnumberBorder blue 0-1
borderRadiusnumber0Border radius
knobsEnabledbooleanfalseShow ADSR knobs beneath the envelope display
knobStyleEnhancedLayerConfig[]Knob styling — a layer array applied to all four knobs.
knobSizenumber34Knob size
knobLabelColorstring'#aaa'Knob label color

Canvas

A surface you draw on yourself, for meters, scopes and displays of your own.

<Canvas>@the-plug/ui

A drawing surface: the 2D canvas API, or WebGPU with mode="gpu".

import { Canvas } from '@the-plug/ui';

<Canvas
  width={240}
  height={80}
  onRender={(ctx, time) => {
    ctx.fillStyle = '#111';
    ctx.fillRect(0, 0, 240, 80);
    ctx.strokeStyle = '#ff6a00';
    ctx.beginPath();
    for (let x = 0; x < 240; x++) ctx.lineTo(x, 40 + 30 * Math.sin(x / 20 + time));
    ctx.stroke();
  }}
  animate={true}
/>
  • Without animate the canvas redraws when the editor does. animate must be written as true or false.
  • mode="gpu" draws with onGpuRender, and the build records that the plugin needs WebGPU.
PropTypeDefaultDescription
widthnumber300Width of the canvas in pixels.
heightnumber150Height of the canvas in pixels.
modeCanvasMode'2d'Rendering mode.
backgroundColorstring'transparent'Background color (CSS color string).
pixelRationumber1Device pixel ratio for high-DPI displays.
animatebooleanfalseDeclare this canvas as CONTINUOUSLY animated: its drawing depends on the frame `time` argument itself (a stateless orbit, a phosphor decay), so it changes every frame by construction and no state or param change will ever mark it dirty.
onRender(ctx: CanvasRenderingContext2D, time: number) => voidCallback for 2D rendering.
on2dRender(ctx: CanvasRenderingContext2D, time: number) => voidAlias for onRender - callback for 2D canvas rendering.
onGpuRender(ctx: GPUContext, time: number) => voidCallback for GPU rendering.
dataFloat32Array | number[] | { [key: string]: any; }Data to pass to the render callback.
data-testidstringOptional test ID for testing.
onPointerDown(event: PointerEvent) => voidCalled when a pointer (mouse/touch) is pressed down on the canvas.
onPointerMove(event: PointerEvent) => voidCalled when the pointer moves over the canvas.
onPointerUp(event: PointerEvent) => voidCalled when a pointer (mouse/touch) is released on the canvas.
onWheel(event: WheelEvent) => voidCalled when the mouse wheel is scrolled over the canvas.
stylePluginComponentStyleOptionsThe ONE author-facing style type: a Canvas is laid out like any other element (absolute positioning, size, z-order, margins), so its style is not a margin/padding subset -- that narrower type rejected the styles plugins already ship (plan 5.3, 2026-09-08).
contextMenuContextMenuItem[]Context menu items shown on right-click.
useNativeContextMenuboolean | numberfalse (custom overlay)Use OS-native context menu (NSMenu/Win32) instead of custom overlay.

Picking one thing from a list, and right-click menus.

<Dropdown>@the-plug/ui

A select menu, bound to a value or to an enumerated parameter.

import { Dropdown } from '@the-plug/ui';

<Dropdown
  param="mode"
  items={[
    { id: 'tape', label: 'Tape' },
    { id: 'tube', label: 'Tube' },
    { id: 'fuzz', label: 'Fuzz' },
  ]}
  width={160}
  showSearch
  onSelect={(id) => console.log('picked', id)}
/>
  • onSelect gets the picked item's id, in the browser preview and in a built plugin alike.
  • param binds the dropdown to a parameter declared with options: picking an item sets the parameter to that item's position.
  • Items can be headers (isHeader), separators (isSeparator) or groups (children). The look of the list goes in style.options.
All 27 props of Dropdown
PropTypeDefaultDescription
keystring | number
childrenNode
stylePluginComponentStyleOptions
classNamestring
idstring
data-testidstring
onClick() => void
onDoubleClick(event: ClickEvent) => voidA click sequence's second press on the element, after that press's onClick (the DOM's dblclick): the event a click gets, on both targets (parity plan O18).
onPointerDown(e: any) => void
onPointerUp(e: any) => void
onPointerMove(e: any) => void
onWheel(e: any) => void
widthnumber
heightnumber
paramstringThe enumerated parameter to bind (see above).
itemsArray<{ id: string; label: string; value?: string; disabled?: boolean; isHeader?: boolean; isSeparator?: boolean; children?: Array<{ id: string; label: string; value?: string; disabled?: boolean; }>; }>
selectedIdstring
valuestringAlias for `selectedId`.
isOpenboolean
maxMenuHeightnumber
showSearchboolean
hoverColorstring
selectedColorstring
onSelect(itemId: string) => void
onOpen() => void
onClose() => void
onSearchChange(query: string) => void

<ContextMenu>@the-plug/ui

A pop-up menu you open yourself. Most components also take a contextMenu prop that opens one on right-click.

import { ContextMenu } from '@the-plug/ui';

<ContextMenu
  open={menu.open}
  x={menu.x}
  y={menu.y}
  items={[
    { label: 'Copy', onClick: () => console.log('copy') },
    { type: 'separator' },
    { type: 'group', label: 'Snap', children: [{ label: '1/8', onClick: () => console.log('1/8') }] },
  ]}
  onClose={() => { menu.open = false; }}
/>
  • contextMenu draws the menu inside the plugin window; nativeContextMenu asks the operating system for one, which can leave the window but takes no styling. A component takes one or the other.
PropTypeDefaultDescription
openrequiredboolean
xrequirednumber
yrequirednumber
itemsContextMenuItem[]Menu items using the unified ContextMenuItem type system.
widthnumber
itemHeightnumber
onClose() => void

Presets

A finished preset menu over the preset calls.

<PresetManager>@the-plug/ui

A preset menu with Save, Save As and Delete, and your factory presets in their own section.

import { PresetManager } from '@the-plug/ui';

<PresetManager api={api} width={220} height={28} />
  • scope keeps presets for one part of the plugin (a scope declared in static presetScopes).
  • scope with sliceIndex keeps presets for one slice of state.slices (a scope declared in static sliceScopes), in the browser and in a built plugin alike: the scope's static sliceFactoryPresets come first, a pick applies to every slice in sliceIndices or to sliceIndex alone, and the menu shows the preset that slice is at. There is no Save in this mode, only Save As and Delete (PluginAPI, Slice presets).
  • onBeforeApply runs just before a preset is applied, in every mode, where you record the undo step; onApplied runs just after it, with the preset's name.
  • Every mode lists the user's presets in one order, on every platform and in the browser: A to Z with letter case set aside, numbers by their value (Preset 2 before Preset 10).
  • Save As refuses a name, in every mode, that is empty or longer than 64 bytes, starts with a dot, or holds /, \, : or a control character: the field closes and nothing is saved.
  • maxMenuHeight caps the open list (300 px by default); past it the list scrolls. Give a menu with a long factory section more.
PropTypeDefaultDescription
apirequiredPresetAPIPlugin API — pass the same `api` your render() method received.
scopestringScope name for scoped/slice presets (omit for generic full-state).
sliceIndexnumberSlice index for per-slice presets (requires both `scope` and the plugin declaring a matching `static sliceScopes` entry).
sliceIndicesnumber[]Slice mode: every slice an apply writes, in one state write — the selection, say.
onBeforeApply() => voidRuns just before a preset is applied or loaded, in every mode — where a host takes its undo snapshot so the change is one step.
onApplied(name: string) => voidRuns just after a preset is applied or loaded, with its name (a factory preset's bare name), in every mode — where a host resyncs what it derives from the changed state.
widthnumberWidth in pixels.
heightnumberHeight in pixels.
maxMenuHeightnumberThe open list's height cap in pixels — the Dropdown's own `maxMenuHeight`, 300 when omitted.
xnumberPosition.
ynumber
styleDropdownStyleOptionsThe control and its open list — any Dropdown style: the closed control's colours, its pseudo-states (`':hovered'`, `':active'`, `':disabled'`), and `options` for the list's rows, hovered/selected rows and section headers (see DropdownOptionStyle).
nameFieldStylePluginComponentStyleOptionsThe "Save As…" name field — any TextField style (and its pseudo-states), spread over the field's defaults the same way.
backgroundColorstringColour shorthands over the dark-theme defaults: `backgroundColor`, `color` and `fontSize` apply to the control and the name field, `borderColor` to the control, `hoverColor` / `selectedColor` to the list's hovered / selected rows.
colorstring
borderColorstring
hoverColorstring
selectedColorstring
fontSizenumber

Asset browsers

Browsing the sample banks and asset folders that ship with the plugin.

<AssetExplorer>@the-plug/ui

A searchable tree. It shows the items you give it; build them from api.samples or api.assets (see the assets page).

import { AssetExplorer } from '@the-plug/ui';

<AssetExplorer
  width={260}
  height={300}
  showSearch
  items={api.samples.getSamples('drums').map((s) => ({ id: s.id, name: s.name, type: 'sample' as const }))}
  onItemActivate={(item) => api.samples.loadSample('drums', item.id)}
/>
  • theme takes an object of colours (AssetExplorerTheme).
PropTypeDefaultDescription
xnumber
ynumber
widthnumber
heightnumber
showSearchboolean
searchPlaceholderstring
showDetailsboolean
showIconsboolean
itemHeightnumber
treeIndentnumber
assetRootsAssetExplorerItem[]
itemsAssetExplorerItem[]
selectedIdsstring[]
expandedIdsstring[]
searchTextstring
themeAssetExplorerTheme
styleRecord<string, any>
onSelect(item: AssetExplorerItem) => void
onItemActivate(item: AssetExplorerItem) => void
onExpandChange(item: AssetExplorerItem, expanded: boolean) => void
onSearchChange(searchText: string) => void
data-testidstring

<AssetExplorerSimple>@the-plug/ui

A flat, searchable list of the items you give it.

import { AssetExplorerSimple } from '@the-plug/ui';

<AssetExplorerSimple
  width={240}
  height={200}
  showSearch
  items={api.assets.listAssets('irs').map((a) => ({ id: a.id, name: a.name, type: 'preset' as const }))}
  onSelect={(item) => console.log(item.id)}
/>
PropTypeDefaultDescription
xnumber
ynumber
widthnumber
heightnumber
showSearchboolean
searchPlaceholderstring
itemsAssetItem[]
selectedIdstring
searchTextstring
onSelect(item: AssetItem) => void
onSearchChange(text: string) => void
data-testidstring

Text and input

Typing, and text that is not part of a control.

<TextField>@the-plug/ui

A one-line text input.

import { TextField } from '@the-plug/ui';

<TextField value={name} placeholder="Preset name" width={200} onChange={(v) => { name = v; }} onSubmit={(v) => console.log('save', v)} />
  • onSubmit fires on Enter; onBlur gets the text when the field loses focus.
  • placeholderColor, selectionColor, selectionTextColor and caretColor work in the browser preview only.
  • autoFocus focuses the field when it appears, in both.
All 27 props of TextField
PropTypeDefaultDescription
valuestringCurrent text value
textstringAlternate prop name for text value (for compatibility)
placeholderstringPlaceholder text shown when empty
disabledbooleanWhether the field is disabled
focusedbooleanWhether the field is focused
showCursorbooleanWhether to show the cursor
widthnumberFixed width in pixels
heightnumberFixed height in pixels
paddingnumberPadding inside the input
fontSizenumberFont size in pixels
onChange(value: string) => voidCalled when text changes
onSubmit(value: string) => voidCalled when Enter is pressed or text is committed
onCommit(value: string) => voidCalled when text is committed (Enter or blur) - alias for onSubmit
onKeyDown(event: { key: string; keyCode: number; shiftKey: boolean; ctrlKey: boolean; altKey?: boolean; metaKey?: boolean; repeat?: boolean; preventDefault: () => void; stopPropagation: () => void; }) => voidCalled when a key is pressed down
onKeyUp(event: { key: string; keyCode: number; shiftKey: boolean; ctrlKey: boolean; altKey?: boolean; metaKey?: boolean; preventDefault: () => void; stopPropagation: () => void; }) => voidCalled when a key is released
onKeyPress(event: { key: string; charCode: number; preventDefault: () => void; stopPropagation: () => void; }) => voidCalled when a character key is pressed (printable characters only)
onFocus() => voidCalled when the field receives focus
onBlur(value: string) => voidCalled when the field loses focus
styleCSSPropertiesStyle object with pseudo-selector support
classNamestringCSS class name
idstringElement ID
data-testidstringTest ID for e2e testing
placeholderColorstringPlaceholder text color
selectionColorstringColor of the selection highlight background
selectionTextColorstringColor of the text within the selection
caretColorstringColor of the caret/cursor
contextMenuContextMenuItem[]Context menu items shown on right-click.

<Text>@the-plug/ui

Text. <span> and <p> work too.

import { Text } from '@the-plug/ui';

<Text style={{ fontSize: 13, color: '#c8c8d0' }}>Input gain</Text>
  • In a built plugin size is a shorthand for the font size, and background for the background colour.
PropTypeDefaultDescription
keystring | number
childrenNode
stylePluginComponentStyleOptions
classNamestring
idstring
data-testidstring
onClick() => void
onDoubleClick(event: ClickEvent) => voidA click sequence's second press on the element, after that press's onClick (the DOM's dblclick): the event a click gets, on both targets (parity plan O18).
onPointerDown(e: any) => void
onPointerUp(e: any) => void
onPointerMove(e: any) => void
onWheel(e: any) => void

<Label>@the-plug/ui

The same as Text.

import { Label } from '@the-plug/ui';

<Label style={{ fontSize: 11, color: '#8a8a99' }}>dB</Label>
PropTypeDefaultDescription
keystring | number
childrenNode
stylePluginComponentStyleOptions
classNamestring
idstring
data-testidstring
onClick() => void
onDoubleClick(event: ClickEvent) => voidA click sequence's second press on the element, after that press's onClick (the DOM's dblclick): the event a click gets, on both targets (parity plan O18).
onPointerDown(e: any) => void
onPointerUp(e: any) => void
onPointerMove(e: any) => void
onWheel(e: any) => void

Layout and HTML tags

The box everything else sits in.

HTML-like tags are typed and styled like components, but a built plugin has no browser, so each tag becomes one of a few native elements:

TagIn a built plugin
divA box (a View), with layout and style.
buttonA Button.
imgAn image compiled into the plugin. src must be written out: a png, jpg or webp of 2 MiB or less in the plugin's files, or a data URI. style.objectFit works.
svg and its childrenVector drawing, kept as SVG.
span, p, h1 to h6, label, section, article, header, footer, nav, aside, main, ul, ol, li, a, form, table and its partsA box holding its text and children. Style it as you would a div.
inputNothing you can use: a built plugin draws an empty box, and the browser preview draws only type="range". Use TextField for text, and Slider or Knob for numbers.

<View>@the-plug/ui

A container, the same as <div>. Lay out its children with flexbox in style.

import { Knob, View } from '@the-plug/ui';

<View style={{ display: 'flex', flexDirection: 'row', gap: 12, padding: 16, background: '#16161c' }}>
  <Knob value={this.getParam('gain')} onChange={(v) => this.setParam('gain', v)} label="Gain" />
  <Knob value={this.getParam('mix')} onChange={(v) => this.setParam('mix', v)} label="Mix" />
</View>
PropTypeDefaultDescription
keystring | number
childrenNode
stylePluginComponentStyleOptions
classNamestring
idstring
data-testidstring
onClick() => void
onDoubleClick(event: ClickEvent) => voidA click sequence's second press on the element, after that press's onClick (the DOM's dblclick): the event a click gets, on both targets (parity plan O18).
onPointerDown(e: any) => void
onPointerUp(e: any) => void
onPointerMove(e: any) => void
onWheel(e: any) => void

AI chat

A chat panel that lets the person using your plugin ask for a sound in words.

The AI page covers what the chat can do with your plugin's tools.

<ChatBox>@the-plug/ui

A chat panel over an AIChat: the person using your plugin asks in words, a model answers, and it can move your parameters or call your tools.

import { ChatBox } from '@the-plug/ui';
import { AIChat } from '@the-plug/core';

<ChatBox chat={chat} width={360} height={480} title="Tone assistant" placeholder="Ask for a darker tone" showSettings />
  • For now it works in the browser preview only. In a built VST3 or AU plugin AIChat cannot reach a model yet.
  • showSettings lets the person using the plugin choose a provider and paste their own key. The key is held in memory and is never built into the plugin.
  • AIChat comes with tools that read and set your parameters; tools adds the ones your plugin defines (see the AI page).
PropTypeDefaultDescription
xnumberPosition X.
ynumberPosition Y.
widthnumberWidth of the chat box.
heightnumberHeight of the chat box.
chatrequiredAIChatThe AIChat runtime instance.
toolsToolDefinition[]Plugin tools the LLM can call.
ragRAGPipelineRAG pipeline for context augmentation.
placeholderstringPlaceholder text for the input field.
titlestringTitle shown in the header.
showSettingsbooleanWhether to show the settings panel for API key entry.
showToolDebuggerbooleanShow the tool visualization debugger panel.
styleChatBoxStyleVisual style overrides.
data-testidstringTest ID.

Icons

27 flat icons drawn as vectors, so they look the same in every format and on every system. Import them from @the-plug/ui. Every icon takes color, size, width, height and style, and most take iconScale and strokeWidth; the extra props are named below. Icons take no pointer events, so put one inside a Button to make it clickable.

import { Button, AudioPlayButton, AudioStopIcon } from '@the-plug/ui';

<div style={{ display: 'flex', gap: 8 }}>
  <Button onClick={() => this.setParam('mode', 1)}>
    <AudioPlayButton size={14} />
  </Button>
  <Button onClick={() => this.setParam('mode', 0)}>
    <AudioStopIcon size={14} color="#e05050" />
  </Button>
</div>
IconDraws
<AudioPlayButton>Play.
<AudioPauseIcon>Pause.
<AudioStopIcon>Stop.
<RecordIcon>Record; armed fills it.
<SkipBackIcon>Skip back.
<SkipForwardIcon>Skip forward.
<LoopIcon>Loop; active lights it.
<VolumeIcon>A speaker with 0 to 3 waves (level), or muted.
<WaveformIcon>A waveform of bars bars.
<MicrophoneIcon>A microphone.
<DrumIcon>A drum.
<BassIcon>A bass guitar.
<NotesIcon>Notes.
<MusicNoteIcon>A music note.
<GearIcon>Settings; teeth sets the cog.
<LinkIcon>A link.
<FolderIcon>A folder; filled fills it.
<CheckIcon>A tick.
<CloseIcon>A cross.
<InfoIcon>Information.
<WarningIcon>A warning.
<ArrowLeftIcon>Left.
<ArrowRightIcon>Right.
<ChevronDownIcon>Open.
<ChevronRightIcon>Closed.
<UndoIcon>Undo.
<RedoIcon>Redo.

FolderIcon, MusicNoteIcon, InfoIcon and WarningIcon draw in the browser preview only for now. A built plugin leaves an empty box where they sit.

Audio displays

Waveforms, a scrolling signal display and an oscilloscope, each from a module of its own.

<AudioWave>@the-plug/audio-wave

A waveform of loaded audio, with selection, playhead, zoom, markers and regions.

import { AudioWave } from '@the-plug/audio-wave';

<AudioWave
  width={520}
  height={120}
  audioBufferId={bufferId}
  displayStyle="mirrored"
  selectionEnabled={true}
  showPlayhead={true}
  playheadPosition={0.25}
  onSelectionChanged={(sel) => console.log(sel)}
/>
  • Set selectionEnabled and showPlayhead yourself: their defaults differ between the documentation comments and the component.
  • Read and set the selection from code with api.modules.audioWave.
All 61 props of AudioWave
PropTypeDefaultDescription
widthnumber400Width of the component in pixels
heightnumber100Height of the component in pixels
displayStyleWaveformDisplayStyle"filled"Waveform display style
waveColorstring"#00ffff"Primary waveform color (CSS color string)
waveColorSecondarystring"#0088aa"Secondary waveform color for mirrored/gradient styles
backgroundColorstring"#1a1a2e"Background color (CSS color string)
lineWidthnumber2Waveform line/bar width
barSpacingnumber1Bar spacing for 'bars' display style (pixels)
borderRadiusnumber0Corner radius for the component
showCenterLinebooleantrueShow a center line at zero amplitude
centerLineColorstring"#333344"Center line color
glowEnabledbooleanfalseEnable glow effect on waveform
glowIntensitynumber0.5Glow intensity (0-1)
glowColorstringGlow color (defaults to waveColor if not set)
gradientWaveformGradientCustom gradient colors for waveform
gridWaveformGridGrid configuration
selectionEnabledbooleantrueEnable selection interaction
selectionSelectionRangeCurrent selection range (controlled mode)
selectionColorstring"rgba(0, 255, 255, 0.2)"Selection highlight color
selectionBorderColorstring"#00ffff"Selection border color
multiSelectbooleanfalseAllow multiple selections
playheadPositionnumber0Current playhead position (0-1 normalized)
showPlayheadbooleantrueShow playhead indicator
playheadColorstring"#ff4444"Playhead color
playheadWidthnumber2Playhead width
zoomnumber1Horizontal zoom level (1 = fit all, 2 = 50% visible, etc.)
scrollOffsetnumber0Scroll offset when zoomed (0-1)
zoomEnabledbooleantrueEnable scroll/zoom interaction
disableWheelZoombooleanfalseDisable mouse wheel zoom (Cmd/Ctrl + scroll)
disableWheelScrollbooleanfalseDisable mouse wheel horizontal scroll
followPlayheadbooleanfalseKeep the playhead in view when zoomed: a frame moves the window when the playhead nears an edge of it or lies outside, and a press reads that window.
markersWaveformMarker[]Marker points to display on the waveform
regionsEnabledbooleanfalseEnable region overlays and interaction (clicking, dragging boundaries, gear icons).
regionWaveformRegion[]Region overlays rendered on the waveform (e.g. slices).
regionCountnumber0Number of regions (used for flat prop decoding)
regionOpacitynumber0.15Region fill opacity (0-1)
regionBorderWidthnumber1Region border line width
showRegionLabelsbooleantrueShow text labels on region overlays
selectedRegionnumber-1Index of the currently selected/highlighted region (-1 = none)
audioBufferIdstringAudio sample data buffer ID (references loaded audio data) The plugin must load audio data and provide the buffer ID.
gainnumber1.0Vertical gain/scale for oscilloscope/spectrum modes. 1.0 maps samples -1..1 to full height. >1 amplifies.
sampleCountnumberNumber of samples in the audio buffer (for calculating display)
sampleRatenumber44100Sample rate of the audio data (for time display)
channelnumber0Channel to display (0 = left/mono, 1 = right, 2 = both)
smoothingnumber1Waveform smoothing factor (1 = none, higher = more smoothing)
minAmplitudenumber-1Minimum amplitude value for normalization
maxAmplitudenumber1Maximum amplitude value for normalization
onSelectionChanged(selection: SelectionRange) => voidCalled when selection changes Receives { start: number, end: number } with normalized positions
onSelectionStart(position: number) => voidCalled when selection starts (mouse down)
onSelectionEnd(selection: SelectionRange) => voidCalled when selection ends (mouse up)
onPlaybackPositionChanged(event: { position: number; }) => voidCalled when playhead position is changed by user interaction
onClick(position: number) => voidCalled when user clicks on the waveform
onDoubleClick(position: number) => voidCalled when user double-clicks on the waveform
onZoomChange(zoom: number, scrollOffset: number) => voidCalled when zoom level changes
onRegionClicked(event: { regionIndex: number; x: number; y: number; }) => voidCalled when a region label or body is clicked (to focus/select it)
onRegionBoundaryChanged(event: { regionIndex: number; start: number; end: number; isEnd: number; }) => voidCalled when a region boundary is dragged to a new position
onRegionGearClicked(event: { regionIndex: number; x: number; y: number; }) => voidCalled when the gear icon on a region label is clicked
onReady() => voidCalled when the component is ready to receive audio data
idstringOptional unique identifier for the component instance
styleRecord<string, any>CSS-like styles object
childrenReact.ReactNodeChild elements

<AudioMarquee>@the-plug/audio-marquee

A scrolling picture of the signal going in and coming out, in 11 modes.

import { AudioMarquee, MarqueeMode } from '@the-plug/audio-marquee';

<AudioMarquee
  width={600}
  height={160}
  sourceInput={api.liveAudio.input}
  sourceOutput={api.liveAudio.output}
  mode={MarqueeMode.Spectrogram}
/>
  • mode is one of the MarqueeMode values: peak, RMS, waveform and mirrored waveform; spectrum bars, spectral line and spectrogram; and the perceptual modes.
  • With a shader it draws through WebGPU instead of Canvas 2D.
PropTypeDefaultDescription
widthnumber600Width of the component in pixels.
heightnumber200Height of the component in pixels.
shaderMarqueeShaderConfigCustom WGSL shader for GPU-accelerated rendering.
sourceInputrequiredstring | nullBuffer id for the pre-process (input) audio source — drawn on the right of the filter line.
sourceOutputrequiredstring | nullBuffer id for the post-process (output) audio source — drawn on the left of the filter line.
sampleRatenumber44100Sample rate of the audio data (for time/frequency calculations).
channelnumber0Channel to visualize (0 = left/mono, 1 = right).
modeMarqueeMode"peak"Active visualization mode.
modeConfigMarqueeModeConfigMode-specific configuration.
modeStyleMarqueeStyleVisual style overrides.
inputWindowSecnumber0.5Duration (in seconds) of the input signal visible before the filter line.
outputWindowSecnumber0.3Duration (in seconds) of the output signal visible after the filter line.
playbackPositionnumber0Current playback position in seconds.
isPlayingbooleanfalseWhether audio is currently playing (enables the animation loop).
showLabelsbooleantrueShow input/output text labels beneath the visualization.
inputLabelstring"INPUT"Label text for the input (right) side.
outputLabelstring"OUTPUT"Label text for the output (left) side.
filterLabelstring"FILTER"Label text for the filter line.
labelFontSizenumber10Font size for labels in pixels.
onReady() => voidCalled when the component is mounted and ready.
onClick(event: { side: 'input' | 'output'; position: number; }) => voidCalled when the user clicks anywhere on the visualization.
idstringOptional unique identifier for the component instance
styleRecord<string, any>CSS-like styles object
childrenReact.ReactNodeChild elements

<Oscilloscope>@the-plug/oscilloscope

A scope trace of a ring buffer your process() fills.

import { Oscilloscope } from '@the-plug/oscilloscope';

<Oscilloscope width={300} height={80} audioBufferId="scope" color="#3ddc84" gain={1.5} />
  • audioBufferId names a static dspState slot that process() writes, oldest sample first.
PropTypeDefaultDescription
widthnumberDisplay width in pixels
heightnumberDisplay height in pixels
colorstringWaveform stroke color (hex)
backgroundColorstringBackground fill color (hex)
lineWidthnumberStroke width for the waveform line
gainnumberVertical amplitude scale factor
showCenterLinebooleanShow center line
centerLineColorstringCenter line color (hex)
glowbooleanEnable glow effect on the waveform
glowIntensitynumberGlow intensity (0-1) when glow is enabled
audioBufferIdstringDspState buffer key to read from (ring buffer convention)
idstringOptional unique identifier for the component instance
styleRecord<string, any>CSS-like styles object
childrenReact.ReactNodeChild elements

Style system

Tags and most components take style={{ … }} with CSS-like keys in camelCase. Layout is flexbox. Numbers are pixels, with no units to write.

Layout and pressed states
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', width: 320, padding: 12 }}>
  <span style={{ color: '#9a9aa6', fontSize: 12 }}>Stereo</span>
  <div
    onClick={() => this.setParam('mode', 1 - this.getParam('mode'))}
    style={{
      paddingLeft: 12,
      paddingRight: 12,
      paddingTop: 6,
      paddingBottom: 6,
      borderRadius: 6,
      backgroundColor: '#2a2a33',
      color: '#e8e8ee',
      cursor: 'pointer',
      ':hovered': { backgroundColor: '#3a3a46' },
      ':active': { backgroundColor: '#5a8dee', color: '#0d0d12' },
    }}
  >
    {this.getParam('mode') === 1 ? 'Wide' : 'Narrow'}
  </div>
</div>
GroupKeys
Layoutdisplay (flex, block, none…), flexDirection, flexWrap, justifyContent, alignItems, alignSelf, alignContent, gap, rowGap, columnGap, flex, flexGrow, flexShrink, flexBasis, order
Size and spacingwidth, height, minWidth, maxWidth, minHeight, maxHeight, padding and its sides, margin and its sides, boxSizing
Positionposition (relative, absolute…), top, right, bottom, left, inset, zIndex
Colour and borderbackgroundColor, background, color, opacity, borderWidth and each side, borderColor, borderStyle, borderRadius and each corner
TextfontSize, fontFamily, fontWeight, textAlign, letterSpacing, whiteSpace
Scrolling and pointeroverflow, overflowX, overflowY, scrollbar (its width, track and thumb), cursor

':hovered', ':active' and ':disabled' restyle an element while the pointer is over it, while it is pressed and while it is disabled. They change backgroundColor, color, borderColor, borderStyle, borderWidth, borderRadius and opacity, and they nest, as in a disabled element's hover.

A few familiar keys are typed but not drawn yet: lineHeight, boxShadow, transition, textOverflow, textTransform, the border shorthands, accentColor and secondaryColor. The build warns about each one and leaves it out. Inside a pressed or hover state, layout keys such as padding and size are not applied either.

Some components style themselves through props instead: a Slider's trackColor, a CurveEditor's own style object, a Knob's layers. Their entries above say so.