Skip to content

Commit 363b0c7

Browse files
committed
Reformat
1 parent 4c6b05b commit 363b0c7

1 file changed

Lines changed: 43 additions & 43 deletions

File tree

  • content/en/docs/apidocs-mxsdk/apidocs/studio-pro-11/pluggable-widgets

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

Lines changed: 43 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ weight: 90
1111

1212
Mendix comes with a wide variety of [Widgets](/refguide/pages/#widgets-categories), but sometimes your app requires a widget outside of this set. To support a more advanced UI pattern or create app-specific interactions, you will need to make your own pluggable widget. This documentation will help you achieve that in Studio Pro 11. See these links for other versions' documentation:
1313

14-
- [Mendix 10](/apidocs-mxsdk/apidocs/pluggable-widgets-10/)
15-
- [Mendix 9](/apidocs-mxsdk/apidocs/pluggable-parent-9/)
16-
- [Mendix 8](/apidocs-mxsdk/apidocs/pluggable-parent-8/)
14+
* [Mendix 10](/apidocs-mxsdk/apidocs/pluggable-widgets-10/)
15+
* [Mendix 9](/apidocs-mxsdk/apidocs/pluggable-parent-9/)
16+
* [Mendix 8](/apidocs-mxsdk/apidocs/pluggable-parent-8/)
1717

1818
Your new pluggable widget can be used while modeling pages alongside standard Mendix components. It can also be shared between multiple apps and distributed through the [Marketplace](/appstore/).
1919

@@ -23,7 +23,7 @@ Pluggable widgets, like core widgets, can have properties which a Mendix develop
2323

2424
Pluggable widgets can also include a preview component for when they are previewed in Studio Pro's **Design mode**.
2525

26-
For information on which libraries Mendix supports when developing pluggable widgets, see the [Pluggable Widgets](/refguide/mendix-client/#pluggable-widgets) section of _Mendix Client_.
26+
For information on which libraries Mendix supports when developing pluggable widgets, see the [Pluggable Widgets](/refguide/mendix-client/#pluggable-widgets) section of *Mendix Client*.
2727

2828
For information on how to update Pluggable Widgets Tools to a newer version, see [Updating Pluggable Widgets Tools](/howto/extensibility/update-pluggable-widgets-tools/)
2929

@@ -42,38 +42,38 @@ A widget component is [mounted](https://en.reactjs.org/docs/react-component.html
4242
A prop value is often not just a primitive value, but an object whose structure depends on the [`type`](#type-attribute) of its widget's property. A prop's values can expose data, metadata, and associated actions — whatever is applicable for the property. Here is an example of one interface. It is a value for an action property, such as the type you would find in the [On click](/refguide/on-click-event/#on-click) property of an action button:
4343

4444
```ts
45-
export interface ActionValue {
46-
readonly canExecute: boolean;
47-
readonly isExecuting: boolean;
48-
execute(): void;
49-
}
45+
export interface ActionValue {
46+
readonly canExecute: boolean;
47+
readonly isExecuting: boolean;
48+
execute(): void;
49+
}
5050
```
5151

52-
The above interface could be used this way: a component uses a `canExecute` flag to decide whether it should be enabled, uses an `isExecuting` flag to show an inline progress indicator, and triggers `execute()` method in a reaction to user click. Normally, after `execute()` has been triggered, the component will be re-rendered with a new value that has the `isExecuting` flag set, and when an action, for example a microflow, completes, the component is re-rendered again without `isExecuting`.
52+
The above interface could be used this way: a component uses a `canExecute` flag to decide whether it should be enabled, uses an `isExecuting` flag to show an inline progress indicator, and triggers `execute()` method in a reaction to user click. Normally, after `execute()` has been triggered, the component will be re-rendered with a new value that has the `isExecuting` flag set, and when an action, for example a microflow, completes, the component is re-rendered again without `isExecuting`.
5353

5454
## Widget Package {#widget-package}
5555

56-
A pluggable widget is distributed as single widget package file with an _.mpk_ extension. This file should be placed in your app's `widgets` directory. Mendix Studio Pro discovers all widgets in your app when you open your app, add a widget through the Marketplace, or click **App** > **Synchronize App Directory**.
56+
A pluggable widget is distributed as single widget package file with an *.mpk* extension. This file should be placed in your app's `widgets` directory. Mendix Studio Pro discovers all widgets in your app when you open your app, add a widget through the Marketplace, or click **App** > **Synchronize App Directory**.
5757

5858
Manually building a widget package can be difficult, so Mendix recommends you use scripts provided by the [Mendix Pluggable Widget Generator](https://www.npmjs.com/package/@mendix/generator-widget). For more information on how to use a generator, see [How To Build a Text Box Pluggable Widget: Part 1](/howto/extensibility/create-a-pluggable-widget-one/).
5959

6060
A widget package file is just a ZIP archive containing the following things:
6161

62-
- A _package.xml_ file describing the whole package
63-
- A widget definition XML file, preferably located in _{widgetName}.xml_ where `widgetName` is the last part of widget [ID](#widget-id)
64-
- A client component of a widget located, for example, in _com/mendix/widget/MyProgressCircle.js_ for a widget with the ID `com.mendix.widget.MyProgressCircle`
65-
- Optionally, a widget preview Studio Pro’s **Design mode** located in _{widgetName}.editorPreview.js_
66-
- Optionally, widget icons (which must be the PNG format):
67-
- _{widgetName}.icon.png_ sets the widget icon inside the Studio Pro toolbox in list view (the ideal image size is 64x64 pixels, but other sizes will be resized to fit)
68-
- _{widgetName}.icon.dark.png_ sets the dark-mode equivalent to _{widgetName}.icon.png_
69-
- _{widgetName}.tile.png_ sets the tile image inside the Studio Pro toolbox in tile view (the ideal image size is 256x192 pixels, but other sizes will be resized to fit)
70-
- _{widgetName}.tile.dark.png_ sets the dark-mode equivalent to _{widgetName}.tile.png_
71-
- Optionally, some widget-related resources, preferably located next to the file which contains the client component
72-
- Note that all CSS files you add (except the one located in the **lib** sub-directory) will automatically be loaded in an app via the widget
62+
* A *package.xml* file describing the whole package
63+
* A widget definition XML file, preferably located in *{widgetName}.xml* where `widgetName` is the last part of widget [ID](#widget-id)
64+
* A client component of a widget located, for example, in *com/mendix/widget/MyProgressCircle.js* for a widget with the ID `com.mendix.widget.MyProgressCircle`
65+
* Optionally, a widget preview Studio Pro’s **Design mode** located in *{widgetName}.editorPreview.js*
66+
* Optionally, widget icons (which must be the PNG format):
67+
* *{widgetName}.icon.png* sets the widget icon inside the Studio Pro toolbox in list view (the ideal image size is 64x64 pixels, but other sizes will be resized to fit)
68+
* *{widgetName}.icon.dark.png* sets the dark-mode equivalent to *{widgetName}.icon.png*
69+
* *{widgetName}.tile.png* sets the tile image inside the Studio Pro toolbox in tile view (the ideal image size is 256x192 pixels, but other sizes will be resized to fit)
70+
* *{widgetName}.tile.dark.png* sets the dark-mode equivalent to *{widgetName}.tile.png*
71+
* Optionally, some widget-related resources, preferably located next to the file which contains the client component
72+
* Note that all CSS files you add (except the one located in the **lib** sub-directory) will automatically be loaded in an app via the widget
7373

74-
Naming your widget package file after the `widgetName` is best practice. Also, a widget package can include multiple widgets by putting several of the above items in the same widget package. However, creating such packages is _not recommended_.
74+
Naming your widget package file after the `widgetName` is best practice. Also, a widget package can include multiple widgets by putting several of the above items in the same widget package. However, creating such packages is *not recommended*.
7575

76-
The _package.xml_ file has the following structure:
76+
The *package.xml* file has the following structure:
7777

7878
```xml
7979
<?xml version="1.0" encoding="utf-8" ?>
@@ -123,20 +123,20 @@ Here is an example of a widget’s attributes section:
123123

124124
This section is generated based on options chosen while running the Mendix Pluggable Widget Generator. You will rarely need to modify it after it is generated. This sample widget features several widget attributes:
125125

126-
- `id`<a id="widget-id"></a> — This the fully qualified name of the widget called widget ID. Using widget ID, the Mendix Platform distinguishes widgets from each other. Widget ID should never be changed after a widget is used in an app or is published in the Marketplace. Reverse domain-style names, as in example above, are recommended.
127-
- `pluginWidget` — This should always be set to `true`. This way, the Mendix Platform can distinguish between the newer pluggable widgets and the older custom widgets.
128-
- `offlineCapable` — This shows if a widget can work while an app is offline. For more information on offline apps, see the [Offline-First](/refguide/offline-first/) guide. A widget that fetches information from a third-party API, for example a widget that fetches airline ticket prices, could not function without an internet connection. If a widget cannot work offline, Mendix Studio Pro will forbid its use on pages that must be available offline.
129-
- `supportedPlatform` — This shows the platforms a widget is compatible with. `Web` describes widgets that are only compatible with web and hybrid mobile apps. `Native` describes widgets that are compatible with native mobile apps.
126+
* `id`<a id="widget-id"></a> — This the fully qualified name of the widget called widget ID. Using widget ID, the Mendix Platform distinguishes widgets from each other. Widget ID should never be changed after a widget is used in an app or is published in the Marketplace. Reverse domain-style names, as in example above, are recommended.
127+
* `pluginWidget` — This should always be set to `true`. This way, the Mendix Platform can distinguish between the newer pluggable widgets and the older custom widgets.
128+
* `offlineCapable` — This shows if a widget can work while an app is offline. For more information on offline apps, see the [Offline-First](/refguide/offline-first/) guide. A widget that fetches information from a third-party API, for example a widget that fetches airline ticket prices, could not function without an internet connection. If a widget cannot work offline, Mendix Studio Pro will forbid its use on pages that must be available offline.
129+
* `supportedPlatform` — This shows the platforms a widget is compatible with. `Web` describes widgets that are only compatible with web and hybrid mobile apps. `Native` describes widgets that are compatible with native mobile apps.
130130

131131
### Widget Description {#widget-description}
132132

133-
The presentation of the widget in Studio Pro is determined by the first set of elements inside the widget tag. The order of these descriptive tags is important, and is demonstrated in the list below. Only the name and description tags are mandatory — the others are optional. The description can be omitted with a self-closing tag: `<description />`:
133+
The presentation of the widget in Studio Pro is determined by the first set of elements inside the widget tag. The order of these descriptive tags is important, and is demonstrated in the list below. Only the name and description tags are mandatory — the others are optional. The description can be omitted with a self-closing tag: `<description />`:
134134

135-
- `name` — The display name of the widget.
136-
- `description` — A short written description of the widget.
137-
- `studioProCategory` — See [Toolbox Category](#toolbox-category).
138-
- `helpUrl` — See [Help Page](#help).
139-
- `icon` — See [Icon](#icon).
135+
* `name` — The display name of the widget.
136+
* `description` — A short written description of the widget.
137+
* `studioProCategory` — See [Toolbox Category](#toolbox-category).
138+
* `helpUrl` — See [Help Page](#help).
139+
* `icon` — See [Icon](#icon).
140140

141141
```xml
142142
<name>My Progress Card</name>
@@ -151,9 +151,9 @@ In Mendix Studio Pro, the widget described above would look like this:
151151

152152
#### Toolbox Category {#toolbox-category}
153153

154-
To provide more clarity for Studio Pro users you can specify a toolbox category for your widgets. When provided, it determines a toolbox category for a widget in Studio Pro. It is possible to specify existing built-in categories such as **Data** or **Input** as well as new arbitrary categories like **Maps**.
154+
To provide more clarity for Studio Pro users you can specify a toolbox category for your widgets. When provided, it determines a toolbox category for a widget in Studio Pro. It is possible to specify existing built-in categories such as **Data** or **Input** as well as new arbitrary categories like **Maps**.
155155

156-
When an existing category is specified, then your widget is placed in it next to existing built-in widgets. When a new category is specified, then your widget placed in that new category.
156+
When an existing category is specified, then your widget is placed in it next to existing built-in widgets. When a new category is specified, then your widget placed in that new category.
157157

158158
A category can be provided through the `studioProCategory` tag:
159159

@@ -181,9 +181,9 @@ A URL of a help page can be provided through the `helpUrl` property after the `d
181181

182182
For more complex help pages you can link to a markdown page. For security reasons, URLs have the following restrictions:
183183

184-
- Must use HTTPS protocol
185-
- Host name must end with _.mendix.com_ or _github.com_
186-
- If host name is _github.com_ the full URL must end with _.md_
184+
* Must use HTTPS protocol
185+
* Host name must end with *.mendix.com* or *github.com*
186+
* If host name is *github.com* the full URL must end with *.md*
187187

188188
#### Icon {#icon}
189189

@@ -385,10 +385,10 @@ This section will explain the shape of the widget property. For more detailed in
385385

386386
Some properties can or must have more attributes or tags. This depends on the `type` property. The following elements should be present for every property:
387387

388-
- `key`<a id="key-attribute"></a> — This element is a property's unique, single-word identifier. The `key` elements are used internally to identify properties, so they should never change after a widget is used in an app or is published in the Marketplace. A `key` element also identifies a property value when it is passed to a pluggable widget’s client component.
389-
- `type`<a id="type-attribute"></a> — This element is a property's type. The `type` element defines which values can be configured for a property, which UI is used in the Mendix Studio Pro, and what type of value a pluggable widget’s client component receives.
390-
- `caption` — This element is a short label identifying a property to a modeling developer. The first letter of a caption should be capitalized.
391-
- `description` — This element is a longer description of a property. A description should be capitalized and limited to one or two sentences.
388+
* `key`<a id="key-attribute"></a> — This element is a property's unique, single-word identifier. The `key` elements are used internally to identify properties, so they should never change after a widget is used in an app or is published in the Marketplace. A `key` element also identifies a property value when it is passed to a pluggable widget’s client component.
389+
* `type`<a id="type-attribute"></a> — This element is a property's type. The `type` element defines which values can be configured for a property, which UI is used in the Mendix Studio Pro, and what type of value a pluggable widget’s client component receives.
390+
* `caption` — This element is a short label identifying a property to a modeling developer. The first letter of a caption should be capitalized.
391+
* `description` — This element is a longer description of a property. A description should be capitalized and limited to one or two sentences.
392392

393393
Here is how a caption and description look in Studio Pro:
394394

0 commit comments

Comments
 (0)