Agent skill

Custom Widgets

by mendixlabs in mendixlabs/mxcli

MDL syntax for pluggable widgets in CREATE PAGE / ALTER PAGE — any installed widget is named by its own name (htmlelement frame (…) { … }), with object lists and child slots read from its definition.

Apache-2.0Auto-check passed

Install Custom Widgets

skills CLI
$ npx skills add mendixlabs/mxcli --skill custom-widgets -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install mendixlabs/mxcli custom-widgets --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/mendixlabs/mxcli.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.claude/skills/mendix/custom-widgets .claude/skills/custom-widgets && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
custom-widgets
GitHub stars
128
Token cost
~7.8k tokens
SKILL.md length
2,835 words
Files
1
Skills in repo
75
Repo updated
First seen
Licence
Apache-2.0

At a glance

MDL syntax for pluggable widgets in CREATE PAGE / ALTER PAGE — any installed widget is named by its own name (htmlelement frame (…) { … }), with object lists and child slots read from its definition.

  • Works in 4 steps: Extract .def.json from .mpk → Extract BSON template from Studio Pro → Place files → …
  • Placing a pluggable widget on a page
  • SKILL.md covers Any installed widget is named…, Built-in Pluggable Widgets, Charts (Mendix Charts.mpk) and Adding a Third-Party Widget, plus 6 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Custom Widgets is an agent skill from mendixlabs/mxcli. MDL syntax for pluggable widgets in CREATE PAGE / ALTER PAGE — any installed widget is named by its own name (htmlelement frame (…) { … }), with object lists and child slots read from its definition. Covers GALLERY, COMBOBOX, DataGrid2, charts and third-party widgets: datasource and column forms, child slots (TEMPLATE/FILTER), the pluggablewidget '<id' fallback, and adding a widget via .def.json. Use when placing a pluggable widget on a page, or when mxcli widget describe output needs interpreting. For the…

Its SKILL.md is about 7.8k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

The repository describes itself as: Mendix cli tool, a headless way to work with Mendix projects. Enables Mendix projects for use with 3rd party agentic coding tools like Claude Code and Copilot. Includes a… The licence is Apache-2.0.

When your agent uses it

  • Placing a pluggable widget on a page
  • Mxcli widget describe output needs interpreting

Example prompts

  • “/custom-widgets”

Workflow steps

4 steps, taken from the step headings in SKILL.md.

  1. Extract .def.json from .mpk
  2. Extract BSON template from Studio Pro
  3. Place files
  4. Use in MDL

What it can do on your machine

Read from SKILL.md and the folder at commit a924d11. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are sql, bash and json).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Custom Widgets loads about 7.8k tokens when it runs. Until then it costs about 149 tokens; SKILL.md has 2,835 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~149
When it runs · the whole SKILL.md, loaded when a task matches
~7.8k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from mendixlabs/mxcli at commit a924d11, republished under its Apache-2.0 licence (© mendixlabs). 2,835 words, ~7,765 tokens.

Download SKILL.mdSave it as .claude/skills/custom-widgets/SKILL.md (or your agent's skills folder).
name
custom-widgets
description
MDL syntax for pluggable widgets in CREATE PAGE / ALTER PAGE — any installed widget is named by its own name (`htmlelement frame (…) { … }`), with object lists and child slots read from its definition. Covers GALLERY, COMBOBOX, DataGrid2, charts and third-party widgets: datasource and column forms, child slots (TEMPLATE/FILTER), the `pluggablewidget '<id>'` fallback, and adding a widget via .def.json. Use when placing a pluggable widget on a page, or when `mxcli widget describe` output needs interpreting. For the widgets THIS project has, read the generated `widgets` skill.

Custom & Pluggable Widgets in MDL

Any installed widget is named by its own name

If a widget is installed in widgets/, MDL names it directly — no keyword list, no widget id:

sql
htmlelement frame (tagName: 'div', tagContentMode: 'container') {
  attribute a1 (attributeName: 'data-testid', attributeValueType: 'expression')
  tagcontentcontainer body {
    dynamictext caption (Content: 'Inside the element')
  }
}

Three things there are read from the widget's definition, not from anything hardcoded: the keyword (htmlelement, the last segment of the widget id), the properties (the widget's own spelling — tagName, not TagName), and the body containers — attribute is an object list (one entry per repetition), tagcontentcontainer a child slot (holds widgets).

Ask the widget rather than guessing. describe widget type <name> lists every property with its type, default and enumeration members; every body container and whether MDL can express it; and a complete example that parses AND checks as written:

bash
mxcli widget describe htmlelement -p app.mpr

Do this first when placing an unfamiliar widget. It is faster than reading this file and it cannot go stale, because it reads the .mpk the project actually has.

The id form is the fallback
sql
pluggablewidget 'com.mendix.widget.web.htmlelement.HTMLElement' frame (tagName: 'div')

Use it only when two installed packages ship the same MDL name, or when you have the id and not the name. Everything below that still shows the id form works unchanged — the short form is simply the better default.

Repeated entries are BLOCKS, never a property value

A widget's repeatable property — FileUploader allowedFileFormats, HTML Element attributes, a chart's series — is written as container blocks in the body:

sql
htmlelement frame ( tagName: 'div' ) {
  attribute a1 (attributeName: 'data-testid', attributeValueType: 'expression')
}

Not as a property value:

sql
htmlelement frame ( attributes: [(attributeName: 'data-testid')] )   -- MDL-WIDGET27

That form is an error (mendixlabs/mxcli#999). It used to be worse than an error: the single-key shape checked clean, exec'd successfully and the property vanished from storage, while the multi-key shape died as missing ')' at ','. The error now names the container keyword and rewrites your entry into the form that works.

The same rule covers the two spellings that carry no entry to key on (mendixlabs/mxcli#1056):

sql
selectionhelper sh (renderStyle: 'custom', customAllSelected: [])          -- MDL-WIDGET27
selectionhelper sh (renderStyle: 'custom', customAllSelected: 'something') -- MDL-WIDGET27

A widgets-typed property such as customAllSelected holds child widgets, so it is written as a block with widgets in it rather than entries:

sql
selectionhelper sh (renderStyle: 'custom') {
  customallselected s1 { dynamictext d1 (Content: 'All') }
}

The empty form is reported from its shape, with no project needed. The scalar form is reported only when the widget resolves, because without a definition p: 'x' is the ordinary property form and flagging it would be a guess. Both matter because a required slot left empty is not a silent no-op at build time — it is CE0642 "Property '…' is required.", one per slot.

describe widget type <name> -p <project.mpr> lists a widget's container keywords under Body containers, and — for an object list — the widgets-typed slots inside one item, with the widget types that route into each:

column        object list  -> columns  authorable
                items: showContentAs, attribute, dynamicText, …
                slot content -> content: any other widget in the item body
                slot filter  -> filter: textfilter | numberfilter | datefilter | dropdownfilter

Read that last line before guessing where something goes. It says a Data Grid 2 column filter is written directly in the column's braces — not in controlbar, which is the grid-wide filter bar and renders "Unable to get filter store" if you put a column filter there.

When the name is not found

A name resolving to no installed definition is an error (MDL-WIDGET25, with near-miss suggestions), and a container the parent does not declare is MDL-WIDGET26. Both need -p: without a project, mxcli knows only its embedded widgets, so it stays quiet rather than reporting every real widget as unknown.

MDL-WIDGET29 needs no project: statictext writes Forms$Text, a type Mendix does not have, and the project that comes out cannot be loaded at all (mx check and Studio Pro both stop at TypeCacheUnknownTypeException before validation). Use dynamictext with a literal Content:. If a widget you have installed is not found, extract its definition:

bash
mxcli widget init -p app.mpr

Built-in Pluggable Widgets

Card-layout list with optional template content and filters.

sql
gallery galleryName (
  datasource: database from Module.Entity sort by Name asc,
  selection: single | multiple | none,
  DesktopColumns: 3,
  TabletColumns: 2,
  PhoneColumns: 1
) {
  template {
    dynamictext title (content: '{1}', contentparams: ({1} = Name), rendermode: H4)
    dynamictext info  (content: '{1}', contentparams: ({1} = Email))
  }
  filter {
    textfilter   searchName  (attribute: Name)
    numberfilter searchScore (attribute: Score)
    dropdownfilter searchStatus (attribute: status)
    datefilter   searchDate  (attribute: CreatedAt)
  }
}
  • template block -> mapped to content property (child widgets rendered per row)
  • filter block -> mapped to filtersPlaceholder property (shown above list)
  • selection: none omits the selection property (default if omitted)
  • DesktopColumns, TabletColumns, PhoneColumns control responsive grid columns (default: 1 each, omit if default)
  • Children written directly under GALLERY (no container) go to the first slot with mdlContainer: "template"
COMBOBOX

Two modes depending on the attribute type:

sql
-- Enumeration mode (Attribute is an enum)
combobox cbStatus (label: 'Status', attribute: status)

-- Association mode (Attribute is an association)
combobox cmbCustomer (
  label: 'Customer',
  attribute: Order_Customer,
  datasource: database Module.Customer,
  CaptionAttribute: Name
)
  • Engine detects association mode when datasource is present (hasDataSource condition)
  • CaptionAttribute is the display attribute on the target entity
  • In association mode, mapping order matters: DataSource must resolve before Association (sets entityContext)
Naming a datasource by its schema key

A widget may expose several datasources. Address one by its own property key (or a registered alias) instead of the generic datasource: clause:

sql
combobox cmbCustomer (
  Association: Order_Customer,
  optionsSourceAssociationDataSource: database from Module.Customer,
  CaptionAttribute: Name
)

The value has to be a datasource, not an entity name. optionsSourceAssociationDataSource: Module.Customer is MDL-WIDGET05: it names an entity, cannot be stored as a datasource, and before mxcli rejected it, it passed check and exec and then failed the build with CE0642 against a property nobody had mentioned (mendixlabs/mxcli#643).

A isLinked datasource is not yours to set. A widget.xml isLinked="true" datasource is filled from the CONTAINING widget — a Data Grid 2 supplies its column filter's linkedDs ("Datasource to Filter"). A .def.json mapping one is refused at build time. Measured on 11.6.6: five Studio Pro-authored drop-down filters store it empty, a filter written without it passes mx check at 0 errors, and a filter written WITH it still fails CE0642 "Property 'Datasource to Filter' is required" — mxbuild resolves the property from the parent rather than reading what is stored, so writing it is not merely useless. Across every widget package in testdata/expr-checker, linkedDs is the only linked datasource among the eight multi-datasource widgets, which is why DROPDOWNFILTER is single-source from MDL's side while COMBOBOX and the charts are not.

The generic datasource: clause stays the convenience form for a single-datasource widget. On one exposing several it names nothing in particular and is refused, with the keys to use instead -- neither guess is defensible: feeding it to every mapping duplicates one binding across unrelated slots, and feeding it to the first leaves the others unset (CE0642 again).

An unqualified attribute binds where the widget says. A property widget.xml links to a datasource (dataSource="parts") binds to its items; one linked to none binds to the enclosing data container's object, not the widget's own data. A name of another entity in scope is refused, naming the candidates (#647).

describe page emits the named keys back when a widget has several configured sources, so describe -> exec keeps each binding on its own mapping. A widget with ONE source keeps the generic DataSource: clause it has always been described with. A source whose schema key cannot be resolved falls back to the generic spelling rather than being dropped.

Charts (Mendix Charts.mpk)

Charts are pluggable widgets. Install Charts.mpk into the project's widgets/ folder first (any Charts-based app has it); exec auto-generates the .def.json.

Each is authorable by its own name — barchart, linechart, piechart, heatmap — and the examples below use the package id form, which also still works. The id column is kept because it is what describe widget prints and what identifies the widget unambiguously.

Chart type → widget id → data container:

ChartWidget id (pluggablewidget '…')Data block
Bar / Column / Areacom.mendix.widget.web.{barchart.BarChart, columnchart.ColumnChart, areachart.AreaChart}series (one or more)
Line / TimeSeries / Bubblecom.mendix.widget.web.{linechart.LineChart, timeseries.TimeSeries, bubblechart.BubbleChart}line (one or more)
HeatMapcom.mendix.widget.web.heatmap.HeatMapwidget-level attrs + scalecolor items
Piecom.mendix.widget.web.piechart.PieChartwidget-level attrs (no object-list)

Series / line — each binds its OWN datasource + X/Y:

pluggablewidget 'com.mendix.widget.web.barchart.BarChart' chart1 {
  series s1 (
    dataSet: 'static',
    DataSource: database from MyModule.SalesByRegion,  -- an OQL VIEW (aggregated)
    staticXAttribute: Region,      -- resolves against the series' own datasource
    staticYAttribute: Total,
    staticName: 'Revenue',
    interpolation: 'linear'        -- line/area only: linear | spline
  )
}

A series datasource takes any of the usual kinds — database from …, microflow …, nanoflow …, $Param, selection … — not just database. (Before #941 describe page rendered every series datasource as database from, so a microflow-backed series described back as a missing entity.)

Pie / HeatMap bind at the WIDGET level (no series block). Both need DataSource:

  • ValueAttribute:; Pie also needs a required SeriesName:; HeatMap adds scalecolor items:
pluggablewidget 'com.mendix.widget.web.piechart.PieChart' pie1 (
  DataSource: database from MyModule.SalesByRegion,
  ValueAttribute: Total,
  seriesName: 'Sales by Region'   -- REQUIRED (CE4899 without it)
)

pluggablewidget 'com.mendix.widget.web.heatmap.HeatMap' heat1 (
  DataSource: database from MyModule.SalesByRegion,
  ValueAttribute: Total           -- REQUIRED (CE0642 without it)
) {
  scalecolor scLow  (valuePercentage: 0,   colorValue: '#f7fbff')
  scalecolor scHigh (valuePercentage: 100, colorValue: '#08306b')
}

Per-chart required-property gotchas (all are mxbuild errors, not check errors):

  • TimeSeries — StaticXAttribute MUST be a Date and time attribute (CE7247 otherwise). Feed it a view with a datetime column.
  • BubbleChart — the line needs a StaticSizeAttribute: (a numeric) in addition to X/Y.
  • PieChart — SeriesName: is required (CE4899); ValueAttribute: is required (CE0642).
  • HeatMap — ValueAttribute: is required (CE0642).

Data feed = OQL view entities. Charts want aggregated data (one row per category). Build a create view entity … as select … group by … and point the chart's DataSource: at it. Never name a view column after an OQL keyword (Quarter/Month/Year/Day → CE0174); use Period etc. (check warns — MDL032).

CE0463 "update this widget" is EXPECTED after generating charts. mxcli writes the WidgetType from an embedded 11.6 baseline; the installed Charts.mpk is a different version, so Studio Pro/mxbuild flags drift. Clear it with mxcli fix widgets (keeps your storage format); docker check only normalizes a temp copy, so check the stored project with --no-update-widgets. The whole mdl-examples/doctype-tests/34-chart-widget-examples.mdl builds 0 errors after. Do NOT run bare mx update-widgets on an MPRv2 project (an mprcontents/-folder project — what mxcli new creates): it converts the project to single-file v1 and deletes mprcontents/, corrupting git, breaking a running mxcli run --local loop, and sometimes making the project unopenable in Studio Pro. mxcli fix widgets writes the result back as v2, mxcli docker check runs on a temporary copy; raw mx update-widgets is only safe on a v1 project or a throwaway diagnostic copy.

DESCRIBE round-trips series/line/scalecolor object-lists (item names are synthesized, e.g. series1); a Pie/HeatMap's widget-level SeriesName/datasource are not yet reconstructed.

Adding a Third-Party Widget

Step 1 -- Extract .def.json from .mpk
bash
mxcli widget extract --mpk widgets/MyWidget.mpk
# Output: .mxcli/widgets/mywidget.def.json

# Override MDL keyword
mxcli widget extract --mpk widgets/MyWidget.mpk --mdl-name MYWIDGET

The extract command parses the .mpk (ZIP archive containing package.xml + widget XML) and auto-infers operations from XML property types:

XML TypeOperationMDL Source Key
attributeattributeattribute
associationassociationassociation
datasourcedatasourcedatasource
selectionselectionselection
widgetswidgets (child slot)container name (key uppercased)
boolean/string/enumeration/integer/decimalprimitivehardcoded value from defaultValue
textTemplatetexttemplateTextTemplate
actionactionOnClick / OnChange, else the property's own key
expression/object/icon/image/fileskippedtoo complex for auto-mapping

Skipped types require manual configuration in the .def.json.

Action slots are matched by name, and the storage key is not the MDL name. Mendix's own widgets suffix theirs — a BadgeButton's click slot is onClickEvent, a HeatMap's is onClickAction, a Combobox's change slot is onChangeEvent — so actionSourceForKey strips one Event/Action suffix before matching onclick/onchange. That is what lets onClick: and OnChange: reach those widgets at all.

Every other action slot is authored by the widget's own key — a named slot:

sql
FILEUPLOADER fu (
  createFileAction:    microflow MyModule.ACT_CreateFile,
  onUploadSuccessFile: microflow MyModule.ACT_AfterUpload
)

In the .def.json a named slot is a mapping with no source, the same shape object-list item mappings use:

json
{"propertyKey": "createFileAction", "operation": "action"}

microflow/nanoflow on a named slot parse as a data source — those forms overlap with dataSourceExprV3 and the datasource alternative has to win, or a chart series' staticDataSource: microflow M.X would become an action. The executor converts them, because the widget definition is the only layer that knows the slot is action-typed. Every other action form (show page, save changes, …) reaches the AST as an action directly.

A slot may be conditional, and writing into a pruned one is CE0463. DataGrid 2's onSelectionChange is hidden when itemSelection = None, so it needs Selection: Multiple (or Single) alongside it. mxcli check refuses the statement with MDL-WIDGET10 rather than letting the build fail. mxcli widget describe <name> lists each slot's hidden when condition.

Object-list item action slots (chart series staticOnClickAction, popupmenu item action) have mappings generated but the engine still skips them at apply time. See upstream #956.

Show full SKILL.md (1,025 more words)Show less
Step 2 -- Extract BSON template from Studio Pro

The .def.json only describes mapping rules. The engine also needs a template JSON with the complete Type + Object BSON structure.

bash
# 1. in Studio Pro: drag the widget onto a test page, save the project
# 2. Extract the widget's BSON:
mxcli bson dump -p App.mpr --type page --object "Module.TestPage" --format json
# 3. Extract the type and object fields from the customwidget, save as:

Place at: project/.mxcli/widgets/mywidget.json

Template JSON format:

json
{
  "widgetId": "com.vendor.widget.MyWidget",
  "name": "My widget",
  "version": "1.0.0",
  "extractedFrom": "TestModule.TestPage",
  "type": {
    "$ID": "aa000000000000000000000000000001",
    "$type": "CustomWidgets$CustomWidgetType",
    "WidgetId": "com.vendor.widget.MyWidget",
    "PropertyTypes": [
      {
        "$ID": "aa000000000000000000000000000010",
        "$type": "CustomWidgets$WidgetPropertyType",
        "PropertyKey": "datasource",
        "ValueType": { "$ID": "...", "type": "datasource" }
      }
    ]
  },
  "object": {
    "$ID": "aa000000000000000000000000000100",
    "$type": "CustomWidgets$WidgetObject",
    "TypePointer": "aa000000000000000000000000000001",
    "properties": [
      2,
      {
        "$ID": "...",
        "$type": "CustomWidgets$WidgetProperty",
        "TypePointer": "aa000000000000000000000000000010",
        "value": {
          "$type": "CustomWidgets$WidgetValue",
          "datasource": null,
          "AttributeRef": null,
          "PrimitiveValue": "",
          "widgets": [2],
          "selection": "none"
        }
      }
    ]
  }
}

CRITICAL: Template must include both type (PropertyTypes schema) and object (default WidgetObject with all property values). Extract from a real Studio Pro MPR -- do NOT generate programmatically. Mismatched structure causes CE0463.

Step 3 -- Place files
project/.mxcli/widgets/mywidget.def.json   <- project scope (highest priority)
project/.mxcli/widgets/mywidget.json       <- template json (same directory)
~/.mxcli/widgets/mywidget.def.json         <- global scope

Set "templateFile": "mywidget.json" in the .def.json. Project definitions override global ones; global overrides embedded.

Step 4 -- Use in MDL
sql
MYWIDGET myWidget1 (datasource: database Module.Entity, attribute: Name) {
  template content1 {
    dynamictext label1 (content: '{1}', contentparams: ({1}=Name))
  }
}

Authoring over MCP (live Studio Pro)

When mxcli runs with --mcp (writes routed to a running Studio Pro), pluggable widgets take a different, simpler path than the MPR writer:

  • No BSON template needed -- skip Step 2 entirely. Only the .def.json (Step 1) is required. Studio Pro owns serialization over pg_patch_page and expands every default, so the CE0463 template-mismatch class does not exist on this path.
  • Any registry-resolved widget is accepted -- same 3-tier resolution (project .mxcli/widgets/ -> global -> embedded). There is no separate MCP whitelist.
  • Supported property operations: attribute, association, primitive, selection, datasource, widgets (child slots), object lists, expression, texttemplate (including {AttrName} placeholders and <Name>Params / contentparams bindings -> template parameters), and action (microflow Module.Flow, show page Module.Page, or none).
  • Rejected loudly (widget refused, nothing sent): actions with argument mappings, other action kinds (save/cancel/close/delete/create/open-link/ nanoflow), and any operation the MCP builder does not translate. The error names each unsupported property.
  • Selector-primitive pruning gotcha: Studio Pro prunes properties made irrelevant by a mode-selector primitive's default. Example: the Image widget drops imageUrl unless ImageType: 'imageUrl' is also set. If a property you set does not appear in Studio Pro, check the widget's mode selector.

.def.json Reference

json
{
  "widgetId":        "com.vendor.widget.web.mywidget.MyWidget",
  "mdlName":         "MYWIDGET",
  "templateFile":    "mywidget.json",
  "defaultEditable": "Always",
  "propertyMappings": [
    {"propertyKey": "datasource",  "source": "datasource", "operation": "datasource"},
    {"propertyKey": "attribute",   "source": "attribute",  "operation": "attribute"},
    {"propertyKey": "someFlag",    "value":  "true",       "operation": "primitive"}
  ],
  "childSlots": [
    {"propertyKey": "content", "mdlContainer": "template", "operation": "widgets"}
  ],
  "modes": [
    {
      "name": "association",
      "condition": "hasDataSource",
      "propertyMappings": [
        {"propertyKey": "optionsSource", "value": "association", "operation": "primitive"},
        {"propertyKey": "assocDS",       "source": "datasource",  "operation": "datasource"},
        {"propertyKey": "assoc",         "source": "association", "operation": "association"}
      ]
    },
    {
      "name": "default",
      "propertyMappings": [
        {"propertyKey": "attr", "source": "attribute", "operation": "attribute"}
      ]
    }
  ]
}
Mode Conditions
ConditionChecks
hasDataSourcethe generic datasource: clause is set, OR any of THIS mode's datasource mappings was given by name
hasDataSource:KEYthe datasource property KEY was given (by its key or an alias)
hasAttributeAST widget has an attribute property
hasProp:XYZAST widget has a property named XYZ

Modes are evaluated in definition order -- first match wins. A mode with no condition is the default fallback.

Use hasDataSource:KEY when several modes are told apart by WHICH datasource is set -- a ComboBox's association vs database mode. Bare hasDataSource cannot distinguish them, so with two such modes the one listed first always wins.

Bare hasDataSource only consults the mode's own datasource mappings, never every datasource-shaped property on the widget: a microflow action and a microflow datasource parse to the same AST shape, so a widget's OnChange: would otherwise select a datasource mode.

6 Built-in Operations
OperationWhat it doesTypical Source
attributeSets Value.AttributeRef on a WidgetPropertyattribute
associationSets Value.AttributeRef + Value.EntityRefassociation
primitiveSets Value.PrimitiveValuestatic value or property name
datasourceSets Value.DataSource (serialized BSON)datasource
selectionSets Value.Selection (mode string)selection
widgetsReplaces Value.Widgets array with child widget BSONchild slot
texttemplateSets text in Value.TextTemplate (Forms$ClientTemplate)property name (resolved as string)

A texttemplate takes text, so a bare value renders the same string on every row. Bind it with the property's own <Name>Params companion, named for whichever spelling the template used (ImageUrl: pairs with ImageUrlParams:) and taking the same format (...) block a dynamictext does — e.g. headerCaption: '{1}', headerCaptionParams: ({1} = Name), or a Timeline's title / description bound separately. contentparams: is ONE list shared by every template on the widget, so it only disambiguates a widget with a single one; '{AttrName}' is the short form for one attribute. A companion whose template has no {N} is MDL-WIDGET21, not a silent drop (ako/mxcli#575). | action | Sets Value.Action with serialized client action BSON | onclick (resolved from AST Action) |

Mapping Order Constraints
  • association source must come AFTER datasource source in the mappings array. The association operation depends on entityContext set by a prior DataSource mapping. The registry validates this at load time.
  • value takes priority over source: if both are set, the static value is used.

Order is NOT how a dependent property finds its entity on a multi-datasource widget. The widget's own package states that per property (widget.xml's dataSource="..."), and mxcli reads it: a DropdownFilter's refCaption binds against refOptions' entity and its attr against linkedDs', whatever order the mappings are in. A property that declares no dataSource falls back to the shared entity context, which is every property of every single-datasource widget -- so the ordering rule above still describes what happens there.

Source Resolution
SourceResolution logic
attributew.GetAttribute() -> pageBuilder.resolveAttributePath()
datasourcew.GetDataSource() -> pageBuilder.buildDataSourceV3() -> also updates entityContext
associationw.GetAttribute() -> pageBuilder.resolveAssociationPath() + uses current entityContext
selectionw.GetSelection() or mapping.Default fallback
CaptionAttributew.GetStringProp("CaptionAttribute") -> auto-prefixed with entityContext if relative
(other)Treated as generic property name: w.GetStringProp(source)

Engine Internals

Build Pipeline

When buildWidgetV3() encounters an unrecognized widget type:

1. Registry lookup: widgetRegistry.Get("MYWIDGET") -> WidgetDefinition
2. template loading: GetTemplateFullBSON(widgetID, idGenerator, projectPath)
   a. Load json from embed.FS (or .mxcli/widgets/)
   b. Augment from project's .mpk (if newer version available)
   c. Phase 1: Collect all $ID values -> generate new UUID mapping
   d. Phase 2: Convert type json -> BSON, extract PropertyTypeIDMap
   e. Phase 3: Convert object json -> BSON (TypePointer remapped via same mapping)
   f. placeholder leak check (aa000000-prefix IDs must all be remapped)
3. Mode selection: evaluateCondition() on each mode in order -> first match wins
4. Property mappings: for each mapping, resolveMapping() -> OperationFunc()
   Each operation locates the WidgetProperty by matching TypePointer against PropertyTypeIDMap
5. Child slots: group AST children by container name, build to BSON, embed via opWidgets
6. Assemble customwidget{RawType, RawObject, PropertyTypeIDMap, ObjectTypeID}
PropertyTypeIDMap

The map links PropertyKey names (from .def.json) to their BSON IDs:

PropertyTypeIDMap["datasource"] = {
  PropertyTypeID: "a1b2c3d4...",   // $ID of WidgetPropertyType in type
  ValueTypeID:    "e5f6a7b8...",   // $ID of ValueType within PropertyType
  DefaultValue:   "",
  ValueType:      "datasource",    // type string
  ObjectTypeID:   "...",           // for nested object list properties
}

Operations use this map to locate the correct WidgetProperty in the Object's Properties array by comparing TypePointer (binary GUID) against PropertyTypeID.

MPK Augmentation

At template load time, augmentFromMPK() checks if the project has a newer .mpk for the widget:

project/widgets/*.mpk -> FindMPK(projectDir, widgetID) -> ParseMPK()
-> AugmentTemplate(clone, mpkDef)
   -> add missing properties from newer .mpk version
   -> remove stale properties no longer in .mpk

This reduces CE0463 errors from widget version drift without requiring manual template re-extraction.

3-Tier Registry
PriorityLocationScope
1 (highest)<project>/.mxcli/widgets/*.def.jsonProject
2~/.mxcli/widgets/*.def.jsonGlobal (user)
3 (lowest)sdk/widgets/definitions/*.def.json (embedded)Built-in

Higher priority definitions override lower ones with the same MDL name (case-insensitive).

Verify & Debug

bash
# list registered widgets
mxcli widget list -p App.mpr

# check after creating a page
mxcli check script.mdl -p App.mpr --references

# full mx check (catches CE0463)
mxcli docker check -p App.mpr

# debug CE0463 -- compare NDSL dumps
mxcli bson dump -p App.mpr --type page --object "Module.PageName" --format ndsl

Common Mistakes

MistakeFix
CE0463 after page creationTemplate version mismatch -- extract fresh template from Studio Pro MPR, or ensure .mpk augmentation picks up new properties
Widget not recognizedCheck mxcli widget list; .def.json must be in .mxcli/widgets/ with .def.json extension
TEMPLATE content missingWidget needs childSlots entry with "mdlContainer": "template"
Association COMBOBOX shows enum behaviorAdd datasource to trigger association mode (hasDataSource condition)
Association mapping failsEnsure DataSource mapping appears before Association mapping in the array
Custom widget not foundPlace .def.json in .mxcli/widgets/ inside the project directory
Placeholder ID leak errorTemplate JSON has unreferenced $ID values starting with aa000000 -- ensure all IDs are in the collectIDs traversal path

Key Source Files

FilePurpose
mdl/executor/widget_engine.goPluggableWidgetEngine, 6 operations, Build() pipeline
mdl/executor/widget_registry.go3-tier WidgetRegistry, definition validation
sdk/widgets/loader.goTemplate loading, ID remapping, MPK augmentation
sdk/widgets/mpk/mpk.go.mpk ZIP parsing, XML property extraction
cmd/mxcli/cmd_widget.gomxcli widget extract/list CLI commands
sdk/widgets/definitions/*.def.jsonBuilt-in widget definitions (ComboBox, Gallery)
sdk/widgets/templates/mendix-11.6/*.jsonEmbedded BSON templates
mdl/executor/cmd_pages_builder_input.goupdateWidgetPropertyValue() -- TypePointer matching

© mendixlabs, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in .claude/skills/mendix/custom-widgets of mendixlabs/mxcli.

Open the folder on GitHubat commit a924d11

Compare with similar skills

Custom Widgets next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Custom Widgets compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Custom Widgets this skillmendixlabs/mxcli128—~7.8kAutomated safety check: PassApache-2.0
Makepad Widgetssickn33/agentic-awesome-skills47k2 repos~1.7kAutomated safety check: PassMIT
Contact Widgetnexu-io/open-design100k—~1.6kAutomated safety check: PassApache-2.0
WidgetLeoYeAI/openclaw-master-skills2.2k—~1.9kAutomated safety check: PassMIT
Chat Widgetsickn33/agentic-awesome-skills47k2 repos~332Automated safety check: PassMIT
Robius Widget Patternssickn33/agentic-awesome-skills47k2 repos~3.1kAutomated safety check: PassMIT

Similar skills

  • Makepad Widgets

    sickn33/agentic-awesome-skills

    Version: makepad-widgets (dev branch) | Last Updated: 2026-01-19 Check for updates: https://crates.io/crates/makepad-widgets

    47k GitHub starsUsed in 2 repos~1.7k tokens
    Auto-check passed
  • Contact Widget

    nexu-io/open-design

    Self-contained floating chat widget with welcome screen, social links, meeting button, and message input.

    100k GitHub stars~1.6k tokensUpdated yesterday
    Auto-check passed
  • Widget

    LeoYeAI/openclaw-master-skills

    Create, update, hide, show, list, and delete Übersicht desktop widgets on macOS.

    2.2k GitHub stars~1.9k tokensUpdated 2 mo ago
    Auto-check passed
  • Chat Widget

    sickn33/agentic-awesome-skills

    Build a real-time support chat system with a floating widget for users and an admin dashboard for support staff.

    47k GitHub starsUsed in 2 repos~332 tokens
    Sales & SupportAuto-check passed
  • Robius Widget Patterns

    sickn33/agentic-awesome-skills

    CRITICAL: Use for Robius widget patterns. An agent skill from sickn33/agentic-awesome-skills.

    47k GitHub starsUsed in 2 repos~3.1k tokens
    Auto-check passed
  • Widget Based Design

    sickn33/agentic-awesome-skills

    Web and App implementation guide for Widget-Based Design. An agent skill from sickn33/agentic-awesome-skills.

    47k GitHub starsUsed in 1 repo~2.5k tokens
    MobileAuto-check passed

More from mendixlabs/mxcli

All 75 skills in this repo
  • Mendix Odata Pushdown

    mendixlabs/mxcli

    Push OData query options into the SQL of a Mendix resource served by a read microflow, so $filter, $orderby, $top, $skip, $count and the key lookup reach the database instead of being silently…

    128 GitHub stars~2.5k tokensUpdated today
    Auto-check passed
  • Mendix Vega Charts

    mendixlabs/mxcli

    Chart a Mendix app with Vega-Lite through a pluggable widget that takes the specification and the data as separate properties, so the model emits rows and never assembles a chart payload.

    128 GitHub stars~3k tokensUpdated today
    Auto-check passed
  • Agents

    mendixlabs/mxcli

    Author Mendix AI agent documents in MDL — Model, Knowledge Base, Consumed MCP Service and Agent, with variables, tools and multi-line prompts.

    128 GitHub starsUsed in 1 repo~2.2k tokens
    Auto-check passed
  • Mendix Bulk Oql Dml

    mendixlabs/mxcli

    Run set-based INSERT, UPDATE and DELETE against Mendix entities through OQL statements, which the runtime supports and Studio Pro cannot author.

    128 GitHub stars~1.4k tokensUpdated today
    Auto-check passed
  • Mock REST APIs

    mendixlabs/mxcli

    Stand up an HTTP endpoint you control instead of a live third-party API, and point the Mendix app at it — Prism from an OpenAPI contract, a constant swap, or a forward proxy.

    128 GitHub starsUsed in 1 repo~2.5k tokens
    Auto-check passed
  • REST Client

    mendixlabs/mxcli

    Call external REST APIs from Mendix — the three approaches (inline REST CALL, consumed REST client document, generated from OpenAPI) and how to choose.

    128 GitHub starsUsed in 1 repo~3.9k tokens
    Auto-check passed

Questions about Custom Widgets

What does Custom Widgets do?

MDL syntax for pluggable widgets in CREATE PAGE / ALTER PAGE — any installed widget is named by its own name (htmlelement frame (…) { … }), with object lists and child slots read from its definition. Custom Widgets is an agent skill from mendixlabs/mxcli. MDL syntax for pluggable widgets in CREATE PAGE / ALTER PAGE — any installed widget is named by its own name (htmlelement frame (…) { … }), with object lists and child slots read from its definition.

When should I use Custom Widgets?

Custom Widgets fits situations like: placing a pluggable widget on a page; mxcli widget describe output needs interpreting.

How do I install Custom Widgets in Claude Code?

Run `npx skills add mendixlabs/mxcli --skill custom-widgets -a claude-code`. Or copy the skill folder (.claude/skills/mendix/custom-widgets in mendixlabs/mxcli) into .claude/skills/custom-widgets in your project. Claude Code loads it when a task matches its description.

How do I install Custom Widgets in Codex?

Run `npx skills add mendixlabs/mxcli --skill custom-widgets -a codex`. Or copy the skill folder (.claude/skills/mendix/custom-widgets in mendixlabs/mxcli) into .agents/skills/custom-widgets in your project. Codex loads it when a task matches its description.

Can I use Custom Widgets in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add mendixlabs/mxcli --skill custom-widgets -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/custom-widgets, .gemini/skills/custom-widgets, .github/skills/custom-widgets and .opencode/skills/custom-widgets in your project.

What does Custom Widgets need to run?

SKILL.md names no scripts, command-line tools or credentials: Custom Widgets is instructions for the agent only.

Does Custom Widgets access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Custom Widgets safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Custom Widgets use?

Custom Widgets is published under the Apache-2.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Custom Widgets use?

About 7.8k tokens (SKILL.md is roughly 31k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Custom Widgets?

Skills that share tags, products or a category with Custom Widgets: Makepad Widgets (sickn33/agentic-awesome-skills, 47k stars), Contact Widget (nexu-io/open-design, 100k stars), Widget (LeoYeAI/openclaw-master-skills, 2.2k stars) and Chat Widget (sickn33/agentic-awesome-skills, 47k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Custom Widgets?

mendixlabs (a GitHub organization) maintains it in mendixlabs/mxcli, which has 128 GitHub stars. The repository holds 75 skills in this directory. The repository was last updated on October 7, 2026.

Source: mendixlabs/mxcli on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.