Param Panel

Button

An action control that fires listeners on press — not a value control.

Buttons are event controls, not value controls. They have no get/set; instead they notify press listeners.

Try it

Each example below is a self-contained file. Edit the source and press Run to see it live.

Usage

const reset = pp.button({
  label: "Reset",
});

Configuration

interface ButtonConfig extends BaseControlConfig {
  label: string;
}

type PressListener = () => void;

interface ButtonControl extends Control<ButtonConfig> {
  onPress(listener: PressListener): Unsubscribe;
  press(): this;
}

onPress returns an Unsubscribe function.

Example

reset.onPress(() => {
  threshold.reset();
  enabled.reset();
});

Programmatic press

press() invokes the exact same listeners as a user click, so you can trigger a button from code or a keyboard shortcut:

reset.press();

On this page