Skip to main content

Action Metadata and Behavior


Use this section to understand how UI components use metadata to trigger behavior in the Doctor App. Action metadata enables consistent, declarative behavior across screens without writing custom JavaScript.


Why Use Action Metadata

Action metadata allows you to configure component behavior declaratively. This approach improves scalability, simplifies maintenance, and enhances testing consistency across the app interface.

Use action metadata to:

  • Trigger navigation or runtime actions.
  • Display banners, popups, or external browser windows.
  • Connect UI inputs to server endpoints without custom logic.
  • Reduce imperative code while maintaining predictable behavior.

Benefits include:

  • Simplified onboarding for developers.
  • Centralized behavior configuration.
  • Consistent interaction patterns.
  • Reduced duplication of logic across components.

Metadata Structure

Configure components using metadata fields that define their behavior. These properties enable UI responses based on user interaction or screen state.

Action Properties

PropertyTypeDefaultDescription
actionstringThe action type to trigger when the component is activated.
argumentstringNoneA parameter passed to the action, such as a URL or data key.
autostartbooleanfalseAutomatically runs the action when the component renders.
closebooleanfalseCloses the parent container or popup after the action completes.
bannerstringNoneAn optional message to display after the action finishes.

Supported Actions

Use these action types to implement behavior based on metadata alone.

IDActionCategoryRequires argumentDescription
1browserGeneralYesOpens a browser tab at the specified URL.
2copyGeneralYesCopies the provided text to the clipboard.
3permissionGeneralYes (CSV)Requests runtime permissions, such as camera or location.
4pageServerYesLoads a new screen using a GET request.
5popupServerYesOpens a modal popup from a GET request.
6patchServerYesSends a PATCH request to update backend data.
7locationServerYesSends a POST request with device coordinates.
8saveServerYesSubmits form data via POST to a backend endpoint.
9cameraVideoNoToggles the device camera on or off.
10flipVideoNoSwitches between front and rear cameras.
11muteVideoNoToggles the microphone mute state.

Example: Metadata Configuration

The following metadata defines a component that automatically loads a country list and displays a popup on screen load:

{
"type": "combo",
"label": "Select Country",
"action": "popup",
"argument": "/v3/countries/list",
"autostart": true,
"close": true,
"banner": "Country list loaded."
}

This configuration:

  • Loads the country list on screen load.
  • Displays the selection as a popup.
  • Closes the popup after completion.
  • Shows a confirmation banner.

Field Type Compatibility

This table outlines which component types support each metadata feature:

TypeCategorySupports ListSupports RangeSupports EventsExamples
FieldTextEmail, Phone, Password
DropdownFieldCombo, Multiselect
RangeFieldInteger, Date, Time

Placement Reference

Use the placement and reference fields to control layout positioning within the screen structure.

Placement Behavior

  • placement: Defines the layout depth (e.g., D-1 for top-level placement).
  • reference: Anchors the component within a named container.

Example

{
"placement": "D-1",
"reference": "filter-section"
}

This example places the component at layout level D-1, inside the container named filter-section.