Skip to main content

WMX Component Schema

WMX Components allow developers to build custom React Native components that integrate directly into WaveMaker Studio. Each component includes UI logic, metadata configuration, and optional visual assets.

For an overview of WMX components, file layout, and getting started, see WMX components.


Component Structure

All WMX components must be placed inside:

src/main/webapp/extensions/components/src

Each component should follow this structure:

    componentname/
├── index.tsx
├── wmx.json
└── icon.svg (optional)
FilePurpose
index.tsxContains UI and component logic
wmx.jsonDefines properties, events, and styles
icon.svgOptional Studio icon

Use a lowercase folder name that matches the name field in wmx.json. After you change wmx.json or index.tsx, build the extensions package (npm run build under extensions/components) so Studio picks up the update.


wmx.json Overview

The wmx.json file defines how the component appears and behaves in WaveMaker Studio.

props, events, and styles are maps: the JSON key is the identifier Studio and the runtime use; the value is the schema object for that entry.

Example

 {
"name": "myComponent",
"displayName": "My component",
"description": "Sample WMX component",
"webSupport": true,
"iconUrl": "icon.svg",
"props": {},
"events": {},
"styles": {}
}

Metadata Fields

FieldDescriptionRequired
nameUnique lowercase identifierYes
displayNameName shown in StudioNo
descriptionHelp textNo
iconUrlSVG icon pathNo
webSupportEnables web previewNo
propsDefines component propertiesNo
eventsDefines component eventsNo
stylesDefines styling optionsNo
FieldDescriptionRequiredDefault
nameComponent identifier in lowercase letters. Must match the component folder name.Yes
displayNameLabel shown in Studio. If omitted, name is used.Noname
descriptionHelp text in the Properties panel.No
iconUrlRelative path to the Studio icon (for example icon.svg).No
webSupportWhen true, the component can render in Studio web preview builds. Does not change on-device mobile behavior.Nofalse
propsMap of custom properties (see Property schema).No
eventsMap of custom events (see Event schema).No
stylesMap of style slots (see Style schema).No

Property Schema

Defines configurable component inputs.

FieldDescription
nameProperty identifier
typestring, number, boolean, object
defaultValueDefault property value
isListSupports array values
isRequiredMarks property mandatory

Each entry under props uses the property name as the map key. Supported fields:

FieldDescriptionRequiredDefault
nameProperty identifier (alphanumeric). Should match the map key.Yes
displayNameLabel in Studio. If omitted, name is used.Noname
descriptionHelp text for the property.No
typestring, number, boolean, or object.Nostring
isListWhen true, the property accepts an array of values.Nofalse
defaultValueInitial value when the widget is placed on a page.No
isRequiredWhen true, Studio treats the property as mandatory.Nofalse

Property example

"props": {
"title": {
"name": "title",
"displayName": "Title",
"type": "string",
"defaultValue": "Hello World",
"isRequired": false
},
"count": {
"name": "count",
"type": "number",
"defaultValue": 0
}
}

Props declared in wmx.json are passed into your component from index.tsx (for example title, count). Bind them to variables in Studio like built-in widget properties.

Reserved properties

Do not add these to wmx.json. The platform provides them:

PropertyPurpose
showVisibility (framework applies hidden styles via root)
nameWidget identifier on the page
disabledDisabled state
classnameCSS class system
stylesRuntime style override object
showindeviceDevice-specific visibility

Event Schema

Defines events triggered by user interaction or state change.

FieldDescription
nameEvent identifier
displayNameStudio label
descriptionEvent usage details

Each entry under events uses the event name as the map key:

FieldDescriptionRequiredDefault
nameEvent identifier. Should match the map key.Yes
displayNameLabel in Studio (often prefixed with "On" in the Events tab).Noname
descriptionHelp text for the event.No

Event example

"events": {
"onTap": {
"name": "onTap",
"displayName": "Tap",
"description": "Fires when the user taps the control"
}
}

Invoke events from index.tsx using the callback prop WaveMaker injects (same pattern as other widgets). Wire handlers on the page in Studio under Events.

Style Schema

Defines styling options exposed to Studio.

FieldDescription
nameStyle identifier
styleDefault style value

Each entry under styles uses the style slot name as the map key:

FieldDescriptionRequiredDefault
nameStyle slot identifier. Should match the map key.Yes
displayNameLabel in the Styles section of the Properties panel.Noname
styleDefault React Native style object for this slot.No

Style example

"styles": {
"container": {
"name": "container",
"displayName": "Container",
"style": { "padding": 16 }
}
}

Destructure style keys in index.tsx and merge them on the appropriate View (see index.tsx overview). Always apply the reserved root style last on the outermost container so show and layout behave correctly.


index.tsx Overview

The index.tsx file contains the React Native implementation of the component.

Example

    import * as React from 'react';
import { View, Text } from 'react-native';

const MyComponent = ({ title = "Hello World" }) => (
<View>
<Text>{title}</Text>
</View>
);

export default MyComponent;

Implementation notes

tip

In the generated app, WaveMaker passes root and text to your component, plus any keys you add under the styles section in wmx.json (for example container). Apply root to your widget's outermost view so Show in Studio and outer layout behave like built-in widgets. Those custom keys are in addition to root; they do not replace it.

  • Export the component as the default export (required).
  • Accept props that match keys under props in wmx.json.
  • Accept style slots that match keys under styles in wmx.json.
  • Include a root prop on the outermost View and apply it last in the style array so visibility and layout from the framework are not overridden:
const MyComponent = ({ root, container, title = 'Hello World' }) => (
<View style={[container, root]}>
<Text>{title}</Text>
</View>
);

For end-to-end creation and push to Studio, see Create WMX components with AIRA. For local edit and Maven sync, see Set up WaveMaker project locally.


icon.svg Guidelines

  • SVG format only
  • Transparent background recommended
  • Suggested stroke color: #737373

Additional icon guidance (minimal design, small-size readability) is on the WMX components overview.


Summary

WMX components combine React Native UI development with metadata-driven configuration. Proper schema definition ensures components remain reusable, configurable, and easy to integrate within WaveMaker Studio.