Custom Fields
Custom fields let streamers adjust your widget from the dashboard without editing code. You define the field schema, and the dashboard renders the UI automatically.Defining Fields
Register your fields withpanel.register(). The dashboard builds the settings UI from this schema:
| Property | Required | Description |
|---|---|---|
key | Yes | Unique identifier, used in getFieldData() |
type | Yes | One of the supported field types below |
label | Yes | Display label in the dashboard |
default | Yes | Initial value when no user setting exists |
min / max | No | For number and range types |
options | No | For select type — array of allowed values |
Accessing Field Values
Updating Fields at Runtime
UsesetField to live-update a field value. By default, the widget re-renders:
Listening for Changes
Supported Field Types
| Type | Dashboard UI | Value Type |
|---|---|---|
text | Single-line input | string |
number | Number input with min/max | number |
color | Color picker | string (hex) |
boolean | Toggle switch | boolean |
select | Dropdown | string |
range | Slider | number |
textarea | Multi-line input | string |
url | URL input | string |
json | JSON editor | object |
Example: Configurable Alert Widget
Getting Fields for a Specific Widget
Pass a widget type or ID togetFieldData:
API Reference
| Method | Returns | Description |
|---|---|---|
getFieldData(typeOrId?) | object | Get all field values for a widget |
setField(key, value, reload?) | void | Update a field (re-renders by default) |