Skip to content
Monitor Components

Monitor

Wraps the Tweakpane monitor binding functionality for boolean, number, and string values.

Technically, any unbound value on a normal Svelte Tweakpane UI component effectively acts as a monitor, but additional monitor-specific components are provided to expose additional view options (e.g. rows).

<Monitor> is a dynamic component, and the availability of additional props will vary depending on the type of the defined value

Note that interval is not exposed on boolean and string monitors because updates are driven by reactive changes in the value.

However, interval is exposed on number monitors Note to allow independent control over the reactive value's update rate and the graph's update rate.

See also the <Waveform> component for a more advanced number visualization.

Usage outside of a <Pane> component will implicitly wrap the monitor in a <Pane position="inline"> component.


Example

πŸ”—
MonitorExample.svelte
<script lang="ts">
import { Monitor } from 'svelte-tweakpane-ui';
let booleanToMonitor = false;
let stringToMonitor = 'Reticulating';
let numberToMonitor = 85;
setInterval(() => {
numberToMonitor = Math.random() * 100;
}, 100);
setInterval(() => {
booleanToMonitor = !booleanToMonitor;
stringToMonitor = [...stringToMonitor].reverse().join('');
}, 1000);
</script>
<Monitor value={numberToMonitor} graph={true} />
<Monitor value={booleanToMonitor} label="Boolean Monitor" />
<Monitor
value={stringToMonitor}
bufferSize={5}
label="String Monitor"
multiline={true}
/>

disabled

πŸ”—
optional
Description

Prevent interactivity and gray out the control.

Typeboolean
Defaultfalse
optional
Description

Text displayed next to control.

Typestring
Defaultundefined
optional
Description

Custom color scheme.

TypeTheme
Defaultundefined
Inherits default Tweakpane theme equivalent to ThemeUtils.presets.standard, or the theme set with setGlobalDefaultTheme().
bindablerequired
Description

The value to control. A string value to monitor. A number value to monitor. A boolean value to monitor.

Typestring | number | boolean
optional
Description

Number of visible rows of state history.

If bufferSize is larger, then the value window will scroll once state history exceeds row count.

Typenumber
Default1
Or 3 if value is string and multiline is true.

bufferSize

πŸ”—
optional
Description

Number of past states to retain.

Typenumber
Default1
Or 64 if value is number and graph is true.

interval

πŸ”—
optional
Description

Time between value samples in milliseconds.

Useful when graph is true. Defaults to reactive value updates only (interval={0}).

Typenumber
Default0

format

πŸ”—
optionaldynamic
Description

A function to customize the number's string representation (e.g. rounding, etc.).

Type((value: number) => string)
Defaultundefined
Normal .toString() formatting.
ConditionsAvailable when value is of type number.
optionaldynamic
Description

Display a graph of the value's changes over time.

Typeboolean
Defaultfalse
ConditionsAvailable when value is of type number.
optionaldynamic
Description

Maximum bound when graph is true.

Typenumber
Default100
ConditionsAvailable when value is of type number.
optionaldynamic
Description

Minimum bound when graph is true.

Typenumber
Default0
ConditionsAvailable when value is of type number.

multiline

πŸ”—
optionaldynamic
Description

Display multiline strings.

Typeboolean
Defaultfalse
ConditionsAvailable when value is of type string.