Modes and feedback styling
Modes let one element show different appearances for different states. Use them for an active source, a light that is on, a selected room, or an equipment status indicator.
The element's base properties are its Default appearance. Each added mode overrides only the properties that need to change. A two-state control therefore needs Default plus one mode, rather than separate Off and On elements.
This guide covers AVstudio Editor NG 27.0.29. The illustrated demonstration changes a local variable without connecting to equipment.
In 27.0.4 and later, a Crestron feedback token can drive activeModeIndex directly: !crestron:type=boolean;name=101! selects Default for false and the first added mode for true. A string join can select a named mode. Test with Crestron emulation in the running preview; the design canvas has no live feedback.
Default properties and mode overrides
| Part | What it contains | Light-control example |
|---|---|---|
| Default | The normal element properties | Gray background and Light OFF label |
| Mode | A named set of changed properties | Blue background and Light ON label |
| Active mode value | A literal or a dynamic value that selects the appearance | $lightOn$ resolves to false or true |
| Actions | Behavior when the element is used | A command configured separately from the appearance |
Mode properties are merged over the base properties. Settings not overridden by the active mode keep their base values. For example, an On mode can change the label and background while preserving the button's dimensions and typography.
Mode overrides can include text, colors, background, border, icons, sizing, and positioning where those properties are supported by the element. A mode cannot contain another modes array.
Keep the touch area consistent when only status is changing. Moving or resizing a control as feedback arrives can make it harder to operate.
Make an on/off indicator
1. Create the driving variable
Run Open Variables and add a boolean global variable named lightOn, with a default value of false.
For a reusable subpage whose state should differ between instances, use a page parameter instead. Define it on the target page and reference it as %lightOn%. See Variables and parameters and Subpages.
2. Configure Default
- Add a Button and give it a name such as
LightStatus. - Open Element Properties.
- Set the default label to Light OFF.
- Set a dark gray background, readable text color, and a suitable touch area.
- Keep these off-state settings in the element's base properties.

Demo captured in NG 0.1.54. Default appearance: the local demonstration variable is false. The test buttons on the right change that variable; they are not equipment commands.
3. Add the On mode
- Click Create element mode when the element has no modes, or Add mode when a mode already exists.
- Name the mode On.
- While editing that mode, change the label to Light ON and the background to blue.
- Leave dimensions and other unchanged settings in Default.
- Keep the mode using the base actions unless it specifically needs different behavior.
4. Connect the active mode value
In Element Properties, find Mode selector by index or name. Bind this field to the global variable lightOn; a variable binding appears with the blue var control and the variable name beside it. In the page file, this sets activeModeIndex to $lightOn$. The runtime resolves the variable and selects:
false→ Default.true→ the first added mode, On.
Creating a mode does not automatically bind it to device state. The active mode value must be set to the intended variable, parameter, or literal selector.
Preview the modes inside VS Code
Select the button on the visual canvas and open Element Properties. Below the selector, Mode preview (editor only) lists 0 Default and the added modes. This lets you inspect each appearance while developing the page.

The development environment with 0 Default selected. The sample project calls its boolean variable docsLightOn; it serves the same purpose as lightOn in the instructions above. Width and Height remain 300 × 72 pixels.
- Select 0 Default to inspect the base appearance.
- Select 1 On to show the On appearance on the canvas.
- Expand Appearance or Content to work on the selected appearance. Check the selected mode before changing a property.
- Return to 0 Default when you want to work on the base settings again.

Selecting 1 On changes the canvas to the blue Light ON appearance. The selection label above the button includes [Mode: 1]. The element name remains Light OFF in this sample: its name identifies the element, while its displayed text changes with the mode.
The editor-only preview is a design aid. Selecting a radio button here does not prove that runtime feedback selects the correct mode. Keep Mode selector by index or name bound to the intended value, then test that binding in Live Preview as described below.
5. Test both directions
For a local test, add separate Set OFF and Set ON buttons. Configure each with an onPress action that sets the boolean variable to false or true. Then open Live Preview and press both buttons.
In the action editor, name the action Set light test state on, choose onPress, select the variable action and lightOn, and set its boolean value to true. Configure the Set OFF button the same way with false.

The same indicator after Set ON. Only its label and background change; its size and position remain the same. Returning the variable to false restores Default.
How selection works
Mode indexes are one-based. Default is the base element, not the first entry in the modes array.
| Active mode value | Selected appearance |
|---|---|
Unset, null, 0, false, or an empty string | Default |
String "0" or "false" | Default |
1 or string "1" | First added mode |
2 through the number of modes | Corresponding added mode |
true or string "true" | First added mode |
| Mode name | Case-insensitive name match |
| Unknown mode name | Default |
$variable$ or %parameter% | Resolve the value first, then apply the selection rules |
Use a boolean for two appearances, a number when the integration supplies a defined state index, or names when states are easier to understand as labels such as Selected and Unavailable.
If you reorder modes, review every numeric selector: 1 now means the first mode in the new order. If you rename a mode, update values that select it by name.
Example: Default, Selected, and Unavailable
A source button can have three appearances:
| State | Selector | Example appearance |
|---|---|---|
| Ready | 0 | Gray background, Ready label |
| Selected | 1 or Selected | Blue background, Selected label |
| Unavailable | 2 or Unavailable | Amber background, Unavailable label |

Three instances with the same mode definitions are shown side by side for comparison. A working source button would select one of these appearances at a time.
To drive this from a string global variable, create sourceState and add two modes:
In Element Properties, set the Default text to Ready with a dark background. Add a Selected mode with blue background and an Unavailable mode with brown background. Keep the base actions unless a mode needs its own behavior. Attach the Mode selector to the global variable sourceState.
Create sourceState before using the token. The values Selected and Unavailable select the matching modes; an empty value selects Default.
An Unavailable appearance is a visual state. Changing its color and text alone does not disable interaction or suppress actions. Configure the intended behavior separately and test it.
Connect modes to device feedback
Use the device's reported state to drive the variable or parameter that selects the mode.
- Configure the project's connector and confirm it receives the required state.
- Bind the driving variable to the corresponding signal, topic, or datapoint using the variable's external-binding settings.
- Ensure the resulting value matches the selector: boolean, numeric index, or mode name.
- Configure the control's outgoing command separately.
- Change the device state from another controller and verify that the interface follows it.
For a light, the press action requests a change; the feedback value reports whether the light is actually on. A command being sent does not prove the equipment reached that state.
Use the local Set ON/OFF buttons only to verify the visual setup before integration. Once testing actual equipment, confirm that the reported device value drives the appearance rather than a local test action.
A mode does not automatically create an offline, pending, or error state. If the interface needs those states, define them and provide a value that selects each one.
Actions in modes
By default, the element's base actions continue to run when a mode is active. A color or label change does not create a new action set.
| Mode configuration | Action behavior |
|---|---|
isModeHasOwnActions: false | Continue using the base actions |
isModeHasOwnActions: true with modeProps.actions | Use the mode's action list in place of the base list |
Use inherited actions when the same command should work in every appearance. Use mode-specific actions only when the active state changes what the control should do.
For example, an Off state might offer Turn on, while the On mode offers Turn off. In that case:
- Put the turn-on action in the element's base action list.
- Enable the On mode's own actions.
- Configure its turn-off action in
modeProps.actions. - Test both states, including state changes received externally.
The mode's own list replaces the base list; it is not appended to it. Include every action that must run in that state. To suppress interaction through an empty action list, explicitly configure and test that behavior rather than assuming a dimmed appearance disables the control.
See Actions and navigation for events, signal types, and value handling.
Styling practices
- Change text or an icon as well as color when users need to distinguish states clearly.
- Keep the base appearance complete so an unknown state still has a readable fallback.
- Override only the properties needed for the mode; keep shared styling in the base element or theme.
- Use meaningful, distinct mode names and document numeric mappings from the control program.
- Keep the element's geometry stable for status-only changes unless movement or resizing is intentional.
For example, a source button can preserve its dimensions, font, and icon position while changing its label, icon color, and background when selected.
Troubleshooting
| Symptom | What to check |
|---|---|
| The mode exists but never appears | Check activeModeIndex; creating a mode alone does not select it |
| A boolean selects the wrong appearance | False maps to Default and true maps to the first added mode; check mode order |
| The second mode never appears with a boolean | Use a numeric or named selector when more than two appearances are needed |
| A named state falls back to Default | Check the supplied name and the defined modes |
| Every repeated card shows the same state | A global variable is shared; use per-instance page parameters when each card needs independent state |
| A property unexpectedly reverts | Check whether it is set in Default or only overridden in one mode |
| Pressing an Unavailable control still sends a command | Visual styling does not disable actions; inspect inherited or mode-specific behavior |
| Base actions stop running | Check whether the active mode enables its own action list |
| State updates locally but not from equipment | Verify the external binding, connector, and value type separately from the appearance |
| The selected appearance changes after reordering modes | Update numeric selectors to match the new one-based order |
Verify the complete setup
- Save and run Run Project Health Check.
- Test Default and every added mode in Live Preview.
- Test transitions in both directions, not just the initial appearance.
- Check unknown named values return to a usable Default state.
- Verify labels, icons, contrast, and touch geometry in every appearance.
- Test inherited and mode-specific actions independently.
- With equipment connected, test state changes made outside this interface.
Continue with Variables and parameters, Actions, Themes, and Subpages.