Create WMX components
Creating a WMX component means writing the React UI in index.tsx, describing its properties and events in wmx.json, and placing the folder under the project's extensions. You can write these files yourself, or have AIRA or an AI coding tool generate them.
For the file layout, see WMX components. For wmx.json and index.tsx details, see the WMX schema reference. For finished examples, see Carousel and custom input examples.
Prerequisites
- A WaveMaker web application that uses the React stack.
- To edit in an external editor, complete Set up WaveMaker project locally first.
Create with AIRA
The AIRA WMX agent can analyze your project, generate the component files, and set up the properties and events for Studio.
Start in AIRA
- In WaveMaker Studio, use the Design / AI toggle at the top of the canvas.
- Select AI to open the AIRA chat panel.
- Describe the component you need, including its properties, events and any library to use.
Example prompt
Create a React web WMX component named
Carouselthat shows a list of images from adatasetproperty, withimageFieldandtitleFieldproperties, autoplay and an interval. FireonSlideChangewith the new index and keep acurrentIndexproperty up to date.
After generation
- Review
index.tsxandwmx.json. Check that the folder name matchesnameinwmx.json, the component has a default export, and you did not declare reserved properties such asshow,nameordisabled. - Apply
classnameand therootstyle to the outermost element. - Sync to Studio if you edited locally:
mvn wavemaker-workspace:push. - Refresh Studio so the component is available.
- Use it on a page or in a form, bind its properties, wire its events, and run the app.
Create with an AI coding tool
Tools such as Cursor or GitHub Copilot can also write the component. Open the project locally, switch the tool to agent mode, and describe the component. Review the generated code, test it with the local preview, and push it to Studio.
Import an existing React component
To use a component you already have, or one from a library:
- Create the component folder and add a small
index.tsxthat imports it and passes through the props you want to control. - Describe those props and events in
wmx.json. - Install the library from the component folder with
npm install. See Add external libraries.
import React from "react";
import { SomeChart } from "some-chart-library";
const Chart = ({ dataset = [], xField, yField, classname = "", styles }) => (
<div className={classname} style={styles?.root?.style}>
<SomeChart data={dataset} x={xField} y={yField} />
</div>
);
export default Chart;
This is the whole integration. dataset, xField and yField become properties you can bind in Studio.
Best practices
- Describe the properties, events and libraries clearly in your prompt.
- Build in small steps, starting with basic behavior.
- Review generated code and test it in the running app.
- Keep property names the same in
wmx.jsonandindex.tsx.
Summary
You can create a WMX component by hand, with AIRA, or with an AI tool, and you can wrap any existing React component the same way. After you push it to Studio, use it on a page or in a form like any other widget.