Interface ValueWrapper<T>

A UI element that holds a typed value and notifies listeners on change. Returned by AddSlider, AddTextInput, AddToggle, AddDropdown, AddTextArea, AddColorPicker, AddFilePicker, AddDirectoryPicker, and AddListBox. Values are automatically persisted to storage on every change and restored on next run.

interface ValueWrapper<T> {
    Hide: () => void;
    Show: () => void;
    Destroy: () => void;
    SetText: (text: string) => void;
    SetStyle: (style: Record<string, unknown>) => void;
    GetValue: () => T;
    SetValue: (val: T) => void;
    OnChange: (callback: (newValue: T) => void) => void;
}

Type Parameters

  • T

Hierarchy (View Summary)

Properties

Hide: () => void

Hides the element without destroying it. Call Show() to make it visible again.

Show: () => void

Makes a previously hidden element visible again.

Destroy: () => void

Permanently removes the element from the UI panel.

SetText: (text: string) => void

Updates the element's display text when the element has a label.

SetStyle: (style: Record<string, unknown>) => void

Merges safe CSS-like renderer style metadata into the element.

GetValue: () => T

Returns the current value of the element.

SetValue: (val: T) => void

Programmatically sets the element's value. Persists to storage and triggers OnChange listeners.

OnChange: (callback: (newValue: T) => void) => void

Registers a callback that fires whenever the user changes the value.