Skip to content

Context engineering: IMAGE widget skill docs missing datasource/imageUrl properties #149

@engalar

Description

@engalar

Problem

The create-page.md skill documentation for IMAGE widget only documents dimension properties:

IMAGE imgLogo (Width: 200, Height: 100)

It completely omits the most important properties: datasource, imageUrl, imageIcon. This causes AI agents to incorrectly conclude that "IMAGE source must be configured manually in Studio Pro" — wasting human effort on something mxcli can do.

Root Cause Chain

  1. create-page.md treats IMAGE as a "simple shorthand widget" with only Width/Height
  2. AI reads this doc, finds no source-setting syntax → assumes it doesn't exist
  3. AI tells user "needs Studio Pro manual step"
  4. User challenges the claim → AI investigates → discovers PLUGGABLEWIDGET syntax works:
PLUGGABLEWIDGET 'com.mendix.widget.web.image.Image' imgLogo (
  datasource: imageUrl,
  imageUrl: 'img/logo_dark.svg',
  widthUnit: pixels, width: 48,
  heightUnit: pixels, height: 48
)
  1. Also works via ALTER PAGE + REPLACE to update existing IMAGE widgets

Proposal

1. Enhance IMAGE section in create-page.md

Add datasource modes and key properties:

### IMAGE Widget — Setting Image Source

IMAGE widgets support three source modes via PLUGGABLEWIDGET syntax:

| Mode | Property | Use Case |
|------|----------|----------|
| `datasource: image` | `imageObject` | Dynamic image from entity (default) |
| `datasource: imageUrl` | `imageUrl: 'path'` | Static image from URL or file path |
| `datasource: icon` | `imageIcon` | Icon-based image |

**Static image from file (most common for logos/branding):**
```sql
PLUGGABLEWIDGET 'com.mendix.widget.web.image.Image' imgLogo (
  datasource: imageUrl,
  imageUrl: 'img/logo.svg',
  widthUnit: pixels, width: 48,
  heightUnit: pixels, height: 48
)

Note: For theme images, use paths relative to theme/web/ (e.g., img/logo.svgtheme/web/img/logo.svg).


### 2. Add cross-reference to `mxcli widget docs`

In `create-page.md`, add a tip:

```markdown
> **Tip:** Run `mxcli widget docs -p app.mpr` to generate complete property documentation
> for all pluggable widgets. Output is saved to `.ai-context/skills/widgets/`.
> When unsure about widget properties, check these generated docs before assuming
> a feature requires Studio Pro.

3. General principle for all shorthand widgets

Add a note that ALL shorthand widgets (IMAGE, COMBOBOX, GALLERY, etc.) are pluggable widgets under the hood and can always fall back to full PLUGGABLEWIDGET syntax for advanced properties not covered by the shorthand.

Impact

Without this fix, AI agents will continue to:

  • Tell users that image sources "need Studio Pro"
  • Miss the PLUGGABLEWIDGET escape hatch for advanced widget configuration
  • Underutilize the full widget property surface that mxcli actually supports

Evidence

Successfully used in Carrefour PoC project — set Carrefour logo on 6 pages entirely via MDL, zero Studio Pro intervention:

ALTER PAGE OrderManagement.Home_Web {
  REPLACE imgLogo WITH {
    PLUGGABLEWIDGET 'com.mendix.widget.web.image.Image' imgLogo (
      datasource: imageUrl, imageUrl: 'img/logo_dark.svg',
      widthUnit: pixels, width: 48, heightUnit: pixels, height: 48
    )
  }
};

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions