Skip to content

Commit 89e6f8c

Browse files
authored
Merge pull request mendix#10426 from MendixVid/pe/PAG-2736-document-maia-pluggable-widgets
Document maia for pluggable widgets
2 parents 92002d2 + c851953 commit 89e6f8c

2 files changed

Lines changed: 91 additions & 0 deletions

File tree

  • content/en/docs

content/en/docs/apidocs-mxsdk/apidocs/studio-pro-11/pluggable-widgets/_index.md

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,93 @@ This section is represented by the `properties` tag in the widget XML file. It d
250250
</properties>
251251
```
252252

253+
### How to Enhance Your Pluggable Widget for Maia by Using `<prompt>` {#using-prompt-for-maia}
254+
255+
Maia can help developers and users work more effectively with pluggable widgets when it understands their purpose and configuration options. To enable this, you can enhance your widget definition XML file with prompt elements that describe your widget's functionality in natural language.
256+
257+
Maia uses these prompts to understand what your widget does and how its properties should be configured, allowing it to provide better assistance when users are building their applications.
258+
259+
#### Adding Prompts to Widgets
260+
261+
You can add a `<prompt>` element to describe the overall purpose and functionality of your widget. This prompt should be placed after the widget description and before the properties section:
262+
263+
```xml
264+
<widget id="com.mendix.widget.web.datagrid.Datagrid" pluginWidget="true" offlineCapable="true" xmlns="http://www.mendix.com/widget/1.0/">
265+
<name>Data grid 2</name>
266+
<description />
267+
<prompt>Add a data grid 2 widget to the page.</prompt>
268+
<properties>
269+
<!-- Properties definition -->
270+
</properties>
271+
</widget>
272+
```
273+
274+
#### Adding Prompts to Properties
275+
276+
Individual properties can also have `<prompt>` elements that explain their purpose and expected values. Property prompts are particularly useful for complex configuration options that might not be immediately clear from the caption alone:
277+
278+
```xml
279+
<property key="itemSelection" type="selection" dataSource="datasource">
280+
<caption>Selection</caption>
281+
<description />
282+
<prompt>Determines whether the user can select rows in the grid.</prompt>
283+
<selectionTypes>
284+
<selectionType name="None" />
285+
<selectionType name="Single" />
286+
<selectionType name="Multi" />
287+
</selectionTypes>
288+
</property>
289+
```
290+
291+
### Best Practices for Writing Prompts {#prompt-best-practices}
292+
293+
Well-written prompts help Maia provide accurate and helpful assistance to developers using your pluggable widget. Follow these best practices when writing prompts for your widgets:
294+
295+
#### Guidelines for Widget Prompts
296+
297+
* **Be concise and action-oriented**: Start with an action verb and keep the prompt under 20 words when possible
298+
* **Focus on use cases**: Describe when and why someone would use this widget
299+
* **Use plain language**: Avoid technical jargon
300+
* **Be specific**: Instead of "displays data," write "displays tabular data with sorting and filtering capabilities"
301+
302+
**Good examples:**
303+
304+
* `"Add a data grid widget to display tabular data with sorting and pagination."`
305+
* `"Create a progress bar to show task completion status."`
306+
* `"Insert a chart widget to visualize numerical data as graphs."`
307+
308+
**Poor examples:**
309+
310+
* `"Widget for data"` (too vague)
311+
* `"Implements advanced data visualization paradigms using reactive patterns"` (too technical)
312+
313+
#### Guidelines for Property Prompts
314+
315+
* **Explain the impact**: Describe how the property affects the widget's behavior or appearance
316+
* **Mention key values**: If the property has important values or ranges, include them
317+
* **Use present tense**: Write as if describing current behavior, not future actions
318+
* **Be specific about relationships**: If a property depends on others, mention that relationship
319+
320+
**Good examples:**
321+
322+
* `"Determines whether users can select single or multiple rows in the table."`
323+
* `"Sets the refresh interval in seconds; 0 disables automatic refresh."`
324+
* `"Controls the color of the progress bar using CSS color values."`
325+
326+
**Poor examples:**
327+
328+
* `"Selection stuff"` (too vague)
329+
* `"Will configure selection"` (wrong tense)
330+
* `"Property for selection configuration management"` (too wordy)
331+
332+
#### General Writing Guidelines
333+
334+
* **Use consistent terminology**: Match the language used in Mendix documentation and Studio Pro
335+
* **Avoid redundancy**: Do not repeat information that is already clear from the caption
336+
* **Keep it updated**: Update prompts when widget functionality changes
337+
338+
By following these guidelines, you help Maia understand your widget's capabilities and provide better assistance to developers using your pluggable widget.
339+
253340
## Property Groups {#property-groups}
254341

255342
Before examining properties themselves, it is useful to understand property groups. Property groups are formed by properties wrapped in a `propertyGroup` tag. Studio Pro uses the property groups to render how the widget configuration UI appears in Studio Pro. Grouping can be used to help the modeling developer understand the configuration of a more complex widget. It is best practice to both use property groups and group properties based on their purposes. The property groups from the code in [Widget Properties Definition](#properties-definition) above forms the following structure:

content/en/docs/refguide/modeling/mendix-ai-assistance/maia-for-pages.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,10 @@ The following widgets are supported if they have been installed:
9696
* [Progress Bar](/appstore/widgets/progress-bar/) (Studio Pro 11.1 and above)
9797
* [Progress Circle](/appstore/widgets/progress-circle/) (Studio Pro 11.1 and above)
9898

99+
{{% alert color="info" %}}
100+
In Studio Pro 11.6 and above, Maia can understand customized pluggable widgets when you enhance your widget definition XML file with the `<prompt>` element. For more information, see the [How to Enhance Your Pluggable Widget for Maia by Using `<prompt>`](/apidocs-mxsdk/apidocs/pluggable-widgets/#using-prompt-for-maia) section in *Pluggable Widgets API*.
101+
{{% /alert %}}
102+
99103
## Read More
100104

101105
* [Pages](/refguide/page/)

0 commit comments

Comments
 (0)