Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Widget Types

MDL supports a comprehensive set of widget types for building Mendix pages. Each widget is declared with a type keyword, a unique name, properties in parentheses, and optional child widgets in braces.

WIDGET_TYPE widgetName (Property: value, ...) [{ children }]

Widget Categories

CategoryWidgets
LayoutLAYOUTGRID, ROW, COLUMN, CONTAINER, CUSTOMCONTAINER
DataDATAVIEW, LISTVIEW, DATAGRID, GALLERY
InputTEXTBOX, TEXTAREA, CHECKBOX, RADIOBUTTONS, DATEPICKER, COMBOBOX
DisplayDYNAMICTEXT, IMAGE, STATICIMAGE, DYNAMICIMAGE
ActionACTIONBUTTON, LINKBUTTON
NavigationNAVIGATIONLIST
StructureHEADER, FOOTER, CONTROLBAR, SNIPPETCALL

Layout Widgets

LAYOUTGRID

Creates a responsive grid with rows and columns. The primary layout mechanism for arranging widgets on a page:

LAYOUTGRID grid1 {
  ROW row1 {
    COLUMN col1 {
      TEXTBOX txtName (Label: 'Name', Attribute: Name)
    }
    COLUMN col2 {
      TEXTBOX txtEmail (Label: 'Email', Attribute: Email)
    }
  }
  ROW row2 {
    COLUMN colFull {
      TEXTAREA txtNotes (Label: 'Notes', Attribute: Notes)
    }
  }
}

ROW

A row within a LAYOUTGRID. Contains one or more COLUMN children.

COLUMN

A column within a ROW. Contains any number of child widgets. Column width is determined by the layout grid system.

CONTAINER

A generic div container. Used to group widgets and apply CSS classes or styles:

CONTAINER cCard (Class: 'card mx-spacing-top-large') {
  DYNAMICTEXT txtTitle (Content: 'Section Title')
  TEXTBOX txtValue (Label: 'Value', Attribute: Value)
}

Properties:

PropertyDescriptionExample
ClassCSS class namesClass: 'card p-3'
StyleInline CSS stylesStyle: 'padding: 16px;'
DesignPropertiesDesign property valuesDesignProperties: ['Spacing top': 'Large']

CUSTOMCONTAINER

Similar to CONTAINER but used for custom-styled containers.

Data Widgets

DATAVIEW

Displays a single object. The central widget for detail and edit pages. Must have a data source:

DATAVIEW dvCustomer (DataSource: $Customer) {
  TEXTBOX txtName (Label: 'Name', Attribute: Name)
  TEXTBOX txtEmail (Label: 'Email', Attribute: Email)
  COMBOBOX cbStatus (Label: 'Status', Attribute: Status)
  FOOTER footer1 {
    ACTIONBUTTON btnSave (Caption: 'Save', Action: SAVE_CHANGES, ButtonStyle: Primary)
    ACTIONBUTTON btnCancel (Caption: 'Cancel', Action: CANCEL_CHANGES)
  }
}

Data source options:

  • DataSource: $ParamName – page parameter
  • DataSource: MICROFLOW Module.MF_Name – microflow returning a single object
  • DataSource: NANOFLOW Module.NF_Name – nanoflow returning a single object
  • DataSource: SELECTION widgetName – currently selected item from a list widget
  • DataSource: ASSOCIATION AssocName – follow an association from a parent context

DATAGRID

Displays a list of objects in a tabular format with columns, sorting, and pagination:

DATAGRID dgOrders (DataSource: DATABASE Sales.Order, PageSize: 20) {
  COLUMN colId (Attribute: OrderId, Caption: 'Order #')
  COLUMN colDate (Attribute: OrderDate, Caption: 'Date')
  COLUMN colAmount (Attribute: Amount, Caption: 'Amount', Alignment: right)
  COLUMN colStatus (Attribute: Status, Caption: 'Status')
  CONTROLBAR bar1 {
    ACTIONBUTTON btnNew (Caption: 'New', Action: MICROFLOW Sales.ACT_CreateOrder, ButtonStyle: Primary)
  }
}

DataGrid properties:

PropertyDescriptionExample
DataSourceData source (DATABASE, MICROFLOW, etc.)DataSource: DATABASE Module.Entity
PageSizeNumber of rows per pagePageSize: 25
PaginationPagination modePagination: virtualScrolling
PagingPositionPosition of paging controlsPagingPosition: both
ShowPagingButtonsWhen to show paging buttonsShowPagingButtons: auto

Column properties:

PropertyValuesDefaultDescription
Attributeattribute name(required)The attribute to display
Captionstringattribute nameColumn header text
Alignmentleft, center, rightleftText alignment
WrapTexttrue, falsefalseAllow text wrapping
Sortabletrue, falsevariesAllow sorting by this column
Resizabletrue, falsetrueAllow column resizing
Draggabletrue, falsetrueAllow column reordering
Hidableyes, hidden, noyesUser visibility toggle
ColumnWidthautoFill, autoFit, manualautoFillWidth mode
Sizeinteger (px)1Width in pixels (manual mode)
Visibleexpression stringtrueVisibility expression
DynamicCellClassexpression string(empty)Dynamic CSS class expression
Tooltiptext string(empty)Column tooltip

LISTVIEW

Displays a list of objects using a repeating template. More flexible than DataGrid for custom layouts:

LISTVIEW lvProducts (DataSource: DATABASE MyModule.Product) {
  CONTAINER cItem (Class: 'list-item') {
    DYNAMICTEXT txtName (Content: '{1}', Attribute: Name)
    DYNAMICTEXT txtPrice (Content: '${1}', Attribute: Price)
  }
}

A pluggable widget that displays items in a card/grid layout:

GALLERY galProducts (DataSource: DATABASE MyModule.Product) {
  CONTAINER cCard {
    DYNAMICTEXT txtName (Content: '{1}', Attribute: Name)
  }
}

Input Widgets

All input widgets share common properties:

PropertyDescriptionExample
LabelField label textLabel: 'Customer Name'
AttributeEntity attribute to bind toAttribute: Name
EditableEditability modeEditable: ReadOnly
VisibleVisibility expressionVisible: '$showField'

TEXTBOX

Single-line text input. The most common input widget:

TEXTBOX txtName (Label: 'Name', Attribute: Name)
TEXTBOX txtEmail (Label: 'Email', Attribute: Email)

TEXTAREA

Multi-line text input for longer text:

TEXTAREA txtDescription (Label: 'Description', Attribute: Description)

CHECKBOX

Boolean (true/false) input:

CHECKBOX cbActive (Label: 'Active', Attribute: IsActive)

RADIOBUTTONS

Displays enumeration or boolean values as radio buttons:

RADIOBUTTONS rbStatus (Label: 'Status', Attribute: Status)

DATEPICKER

Date and/or time input:

DATEPICKER dpBirthDate (Label: 'Birth Date', Attribute: BirthDate)

COMBOBOX

Dropdown selection for enumeration values or associations. Uses the pluggable ComboBox widget:

COMBOBOX cbStatus (Label: 'Status', Attribute: Status)

REFERENCESELECTOR

Dropdown for selecting an associated object via a reference association:

REFERENCESELECTOR rsCategory (Label: 'Category', Attribute: Category)

Display Widgets

DYNAMICTEXT

Displays dynamic text content, often with attribute values:

DYNAMICTEXT txtGreeting (Content: 'Welcome, {1}', Attribute: Name)

IMAGE / STATICIMAGE / DYNAMICIMAGE

Display images on a page:

-- Static image from the project
STATICIMAGE imgLogo (Image: 'MyModule.Logo')

-- Dynamic image from an entity attribute (entity must extend System.Image)
DYNAMICIMAGE imgPhoto (DataSource: $Photo, Width: 200, Height: 150)

-- Generic image widget
IMAGE imgBanner (Width: 800, Height: 200)

Image properties:

PropertyDescriptionExample
WidthWidth in pixelsWidth: 200
HeightHeight in pixelsHeight: 150

Action Widgets

ACTIONBUTTON

A button that triggers an action. The primary interactive element:

ACTIONBUTTON btnSave (Caption: 'Save', Action: SAVE_CHANGES, ButtonStyle: Primary)
ACTIONBUTTON btnCancel (Caption: 'Cancel', Action: CANCEL_CHANGES)
ACTIONBUTTON btnDelete (Caption: 'Delete', Action: DELETE, ButtonStyle: Danger)

Action types:

ActionDescription
SAVE_CHANGESCommit and close the page
CANCEL_CHANGESRoll back and close the page
DELETEDelete the current object
CLOSE_PAGEClose the page without saving
MICROFLOW Module.MF_NameCall a microflow
NANOFLOW Module.NF_NameCall a nanoflow
PAGE Module.PageNameOpen a page

Button styles:

StyleTypical appearance
DefaultStandard button
PrimaryBlue/highlighted button
SuccessGreen button
WarningYellow/amber button
DangerRed button
InfoLight blue button

Microflow action with parameters:

ACTIONBUTTON btnProcess (
  Caption: 'Process',
  Action: MICROFLOW Sales.ACT_ProcessOrder(Order: $Order),
  ButtonStyle: Primary
)

LINKBUTTON

Renders as a hyperlink instead of a button. Same action types as ACTIONBUTTON:

LINKBUTTON lnkDetails (Caption: 'View Details', Action: PAGE MyModule.Customer_Detail)

Structure Widgets

Header section of a DataView, placed before the main content:

DATAVIEW dvOrder (DataSource: $Order) {
  HEADER hdr1 {
    DYNAMICTEXT txtOrderTitle (Content: 'Order #{1}', Attribute: OrderId)
  }
  TEXTBOX txtStatus (Label: 'Status', Attribute: Status)
  FOOTER ftr1 { ... }
}

Footer section of a DataView. Typically contains save/cancel buttons:

FOOTER footer1 {
  ACTIONBUTTON btnSave (Caption: 'Save', Action: SAVE_CHANGES, ButtonStyle: Primary)
  ACTIONBUTTON btnCancel (Caption: 'Cancel', Action: CANCEL_CHANGES)
}

CONTROLBAR

Control bar for DataGrid widgets. Contains action buttons for the grid:

CONTROLBAR bar1 {
  ACTIONBUTTON btnNew (Caption: 'New', Action: MICROFLOW Module.ACT_Create, ButtonStyle: Primary)
  ACTIONBUTTON btnEdit (Caption: 'Edit', Action: PAGE Module.Entity_Edit)
  ACTIONBUTTON btnDelete (Caption: 'Delete', Action: DELETE, ButtonStyle: Danger)
}

SNIPPETCALL

Embeds a snippet (reusable page fragment) into the page:

SNIPPETCALL scNav (Snippet: MyModule.NavigationMenu)

Renders a navigation list with clickable items:

NAVIGATIONLIST navMain {
  -- navigation items
}

Common Widget Properties

These properties are shared across many widget types:

PropertyDescriptionExample
ClassCSS class namesClass: 'card p-3'
StyleInline CSS stylesStyle: 'margin-top: 8px;'
DesignPropertiesAtlas design propertiesDesignProperties: ['Spacing top': 'Large', 'Full width': ON]
VisibleVisibility expressionVisible: '$showSection'
EditableEditability modeEditable: ReadOnly

See Also