Controls and configuration
Gizmos return a declarative view. Scape renders standard fields and buttons, groups editor settings under Configure, and handles focus, pending state, errors and deletion.
Actions and switches
A control names an action and payload. The reducer still validates the request.
ts
{ id: 'ring', label: 'Ring', placement: 'action',
action: { name: 'ring', payload: {} } }1
2
2
placement: 'action' places a control in the main action row with the default play icon. Its label remains the accessible name and tooltip. Placement never changes permission or exposes protected fields.
A participant switch uses icon: 'toggle' with a boolean pressed. Use a meaningful label such as “Turn off” or “Turn on”. See Lamp.
SDK 0.3.4 also supports icon: 'tab' with a boolean pressed: it shows tab-open while off and tab-close while on, for controls such as a permanent mini card. Like a toggle, this control cannot submit fields. placement: 'action' keeps an editor-authorized control in the main row without changing its permission.
Browse Scape's icon family in Nucleo's Micro Bold catalog. Scape supplies the licensed game icons. Developers referencing supported icon IDs in the game do not need to purchase them. Artwork remains in Scape; SDK documentation lists identifiers rather than reproducing an icon gallery.
Two-step content actions and icon IDs
Use button and a nonempty confirm message for an icon-first content action:
ts
{
id: 'save', label: 'Save question', button: { preset: 'save' },
confirm: 'Save question?', fields: ['question'],
action: { name: 'configure', payload: {} },
}
// A unique action uses the same component and an approved ID:
{
id: 'close', label: 'Close voting', button: { icon: 'lock' },
confirm: 'Close voting?', action: { name: 'toggle', payload: {} },
}1
2
3
4
5
6
7
8
9
10
2
3
4
5
6
7
8
9
10
The first activation reveals the same icon beside the confirmation text; the second submits. The initial label is the accessible name and tooltip. Editing fields, changing actions, leaving the button, pressing Escape, or changing the view/target/permissions clears review. Pending actions use Scape's shared spinner and cannot be submitted twice. A failed action requires fresh confirmation. Permissions and reducer validation still apply. Buttons cannot also specify icon, placement, trigger, kind, or pressed; immediate choices and switches keep their existing controls.
ACTION_BUTTON_PRESETS supplies these icon mappings:
| Preset | Icon ID |
|---|---|
save | check |
reset | refresh |
start | media-play-filled |
pause | media-pause-filled |
close | lock |
delete | trash |
add | plus |
cancel | xmark |
Presets select artwork, not action behavior, permission, or wording. Supply your own concise labels and confirmation questions. Do not duplicate Scape's object removal control with a delete preset; use it for action-specific content removal.
ACTION_ICONS is the runtime list and ActionIcon provides TypeScript completion: check, refresh, media-play-filled, media-pause-filled, lock, trash, plus, xmark, gear, clone-2, download, import, paper-plane-2, external-link, volume, ban, broom, star.
Browse the artwork on Nucleo's Micro Bold catalog. Scape supplies the licensed game assets; referencing a supported ID in a Gizmo does not require developers to purchase icons. The SDK includes identifiers only, not artwork or a republished gallery. Nucleo's full catalog is larger than Scape's approved list. If an action needs another icon, request its addition to Scape's shared set. SVG, URLs, emoji and arbitrary icon names are rejected.
Connect to other Gizmos
Expose explicit event or boolean inputs to let another Gizmo invoke your participant actions. Scape adds Connect to… and a sentence editor; a switch control alone does not expose an input. See connectors and signals for wiring, held values and readable port labels.
Fields
Views support native text, select, date, time, color, emoji, number, boolean, slider, radio and checklist fields. Each field has a unique id, a visible label and its saved value. A control references field IDs; Scape collects their draft values into the action payload under those IDs.
| Kind | Submitted value | Declaration |
|---|---|---|
text (or omitted) | String | Required maxLength; add multiline: true for notes |
select | String | Required options with unique value and readable label |
date | String | YYYY-MM-DD or empty; optional inclusive min and max |
time | String | HH:mm or empty; optional inclusive min and max |
color | String | Lowercase six-digit hex such as #0099ff; optional palette |
emoji | String | One emoji from Scape's scene library; host-provided categories and search |
number | Number | Required finite min, max and positive step |
slider | Number | Native range with required min, max, step; the same bounds as number |
radio | String | Native radio group with the same options contract as select |
checklist | String array | Unique selections from options; an empty selection is allowed |
boolean | Boolean | A labeled checkbox with true or false |
Sliders submit numbers and checklists submit arrays of option values. Checklist values must be unique and present in the options; validate a minimum selection count in your action when needed. Sliders preview during dragging and commit on release (or a native keyboard change).
Numbers and booleans retain their JSON types; do not compare them with strings such as "10" or "true". An empty numeric input is invalid, not zero. Numeric values must be within the inclusive bounds and align with step, starting at min. A color palette supplies suggestions alongside the full picker; it does not restrict accepted colors.
Date and time values are separate calendar and clock strings. Scape does not infer a timezone, convert them to UTC or schedule an event. Store an explicit timezone when your feature needs one, and handle daylight-saving ambiguities in your own action logic. Empty date/time values are valid field values; an action must reject them when required. Time bounds cannot wrap past midnight.
See the Event form walkthrough for all these fields in one definition, and field limits for exact bounds.
Saving fields
ts
fields: [{
id: 'direction', label: 'Direction', kind: 'select', value: state.direction,
options: [
{ value: 'right', label: 'Right' },
{ value: 'left', label: 'Left' },
],
}],
controls: [{
id: 'direction', label: 'Set direction', fields: ['direction'],
trigger: 'change', action: { name: 'configure', payload: {} },
}],1
2
3
4
5
6
7
8
9
10
11
2
3
4
5
6
7
8
9
10
11
Automatic trigger: 'change' controls submit when a referenced field commits a change and render no separate Save button. Referenced fields may be selects, dates, times, colors, numbers, booleans, sliders, radio groups or checklists. Text, including multiline text, requires an explicit save. A field can belong to only one automatic control. These controls cannot also request confirmation, a toggle icon, an action button preset, a preview kind or action-row placement.
Without trigger, fields submit together through an ordinary button. Use this for a form whose values should be checked and saved together. Compatible view refreshes preserve dirty drafts; failed explicit saves retain edits for correction. Changes to field kinds or constraints, permissions or the selected object can invalidate an editor or pending confirmation. Scape prevents duplicate submissions while an action is pending.
Validate submitted values again in the action with validObjectFieldValue(field, value), using your own trusted field declarations. This checks the field's type, bounds, choices or length. It does not validate the whole payload, authorize an action or enforce domain rules. Check allowed payload keys, required fields and permissions separately, and return a useful ObjectActionError when a request is invalid. Keep total payload size within the action limit, even if individual text fields allow more characters.
Shared rows
Use ObjectView.rows to arrange native fields, action buttons and read-only text side by side. Declare each field, control or list item normally, then reference it by kind and ID. Title and description use their kind alone:
ts
rows: [
{ id: 'when', label: 'Date and time', elements: [
{ kind: 'field', id: 'date' },
{ kind: 'field', id: 'time' },
] },
{ id: 'submit', sizing: 'content', elements: [
{ kind: 'field', id: 'notes' },
{ kind: 'control', id: 'save' },
] },
{ id: 'summary', elements: [
{ kind: 'description' },
{ kind: 'item', id: 'status' },
] },
],1
2
3
4
5
6
7
8
9
10
11
12
13
14
2
3
4
5
6
7
8
9
10
11
12
13
14
The referenced elements must exist in that view. Rows and their elements appear in the declared order before ungrouped content in each section. Omit rows to keep the standard vertical layout. Elements not mentioned in a row retain their normal layout. sizing: 'equal' (the default) shares the available width; 'content' uses natural widths. Both wrap when the available space is too narrow. Scape owns widths, spacing, field styling and keyboard order. Each field keeps its label, native picker and validation. A color field's optional palette remains part of that field. Use an optional row label to name the group for screen readers.
Multiline fields always occupy a full line, so other fields and actions cannot appear beside a textarea, even when a row uses content sizing.
Rows do not grant permission or change which actions receive field values. Editor controls and their private fields remain inside Configure. A row mixing public and editor elements is split across those sections; unavailable elements and empty rows are omitted. Read-only title, description and items remain public; layout is not a way to hide sensitive data. A title equal to the Gizmo's label still uses the host header. A referenced action-row button moves into content, inside Configure when editor-only. Automatic trigger: 'change' controls have no visible button and cannot be referenced; group their fields instead.
There are at most 32 rows with 1–8 elements each. Row IDs are unique and use the usual 1–64 character identifier format. A native element can occur in only one row. Nested rows, arbitrary CSS, embedded web panels and host-owned Configure, Delete and connection controls are outside this layout API. See the Event form and Lamp examples.
Portable settings
Declare configuration to identify the editor action and fields that may be copied to later placements. remember can reuse accepted settings during a placement session; open opens Configure on ordinary taps for settings-first objects. On ordinary taps, the default is closed.
Scape automatically opens setup after placement for configurable gizmos and gizmos with editable fields, including TV and market pickers. This does not require open: true. A placement that actually reuses remembered settings stays closed; the first placement without saved settings still opens setup. Reset-only commands, participant controls and embedded content alone do not trigger initial setup.
Configuration goes through the normal action and permission checks. It is not a whole-state export. Use configuration types to see the exact contract.
Text and previews
worldText(state) supplies bounded plain text. textEditor reuses Scape's anchored editor for one string field; it targets an editor action. Sign is the built-in composition of these capabilities. Text is not HTML or executable UI.
worldTextRange optionally limits label visibility to a distance greater than zero and at most 32 cells. It works independently of world picking or navigation. Omit it for normal always-visible world text.
A control with kind: 'preview' resolves through previews. A preview is local, does not broadcast, and does not mutate shared state. Piano uses a local preview to audition a note.
Let Scape own the panel
Do not add duplicate Configure, Close or Delete controls. Scape owns those affordances and the removal permission checks. Keep labels concise and useful for people using a keyboard or screen reader.
Views allow at most 16 fields and 32 controls; selects contain 1–64 unique values. See limits and API declarations.
Website and HTML panels
Declare a fixed source on ObjectDefinition.web: either an HTTPS website chosen by the developer or a bundled HTML document. Players cannot configure the URL or replace the document. Use ObjectView.webData for public state updates.
See Website and HTML panels for complete examples, inline JavaScript, the participant-action bridge, connections and security limits.
Emoji picker
Use { id: 'emoji', label: 'Emoji', kind: 'emoji', value: '🔳' } for Scape's native emoji picker. It provides categories and name search over the game's existing scene emoji library. Authors do not supply options or accept arbitrary text. Associate the field with an action as usual; trigger: 'change' saves a selection immediately. The host retains pending, permission and stale-view guards. Validate the action payload in your reducer. Scape also rejects direct submissions outside the game library for these fields.
Scape also owns scrolling and spacing. A final full-width native picker reaches the popover's rounded bottom edge and carries its own inset inside the scrolling content. Forms and lists followed by other controls retain ordinary section spacing. No layout flags, padding values or custom CSS are needed in your Gizmo.
Walkable tile demonstrates the picker with permission: 'editor' and editPolicy: 'placer-admin', allowing only world owners and moderators to change appearance. Its sprite recipe changes the picture while keeping the saved gizmo identity and walkability. Existing 🟦 tiles remain supported. It also opts into configuration.remember: true: later placements reuse the last successfully saved emoji in the current session, without reopening Configure. After a reload the default is 🔳. Remembered settings are applied only while the current user has configuration permission. Host support and the matching SDK must be published before using this new field on a hosted environment.
