Sidebar toggle button

Last update: Download PDF Edit

The sidebar toggle is a button that when pressed will make a region of a scroll container (Mendix 5.18) or layout container appear or disappear. This makes it possible to create sidebars, for instance a menu on a mobile phone that is hidden by default and can be shown by clicking the button. See the picture for an example layout that used the sidebar toggle. 

Button properties


The caption defines the text that will be shown. The template can contain parameters that are written as a number between braces, e.g. {1}. The first parameter has number 1, the second 2 etcetera. Note that to use template parameters the widget must be placed in a context of an entity, e.g. inside a data view or list view. The parameters will be replaced by the values of the attributes.

Before 5.19:

The caption can be set to either a literal value, or an attribute value. A literal caption specifies a translatable text. See Translatable Texts. An attribute caption specifies a path to an attribute. The path starts at the entity of the entity widget in which this widget is contained.


This property indicates which image will be shown in front of the caption of the button.


The icon property determines the icon that will be shown in front of the caption of the button. There are three options: no icon, a glyph icon or a (bitmap) image. Glyph icons come from the Bootstrap Halflings collection. The advantages of a glyph icon over a bitmap image are that glyphs are scalable, look sharp on high-resolution screens and their color can be changed by changing the font color. The advantage of an image icon is that it can have multiple colors.

Render mode

This property indicates how the button is rendered.

ButtonThe trigger is rendered as a button.
LinkThe trigger is rendered as a hyperlink.

Default value: Button

Button Style

This property applies a predefined styling to the button.

Common properties


The internal name of the widget. You can use this to give sensible names to widgets. The name property also appears in the generated HTML: the widget DOM element automatically includes the class ‘mx-name-{NAME}’, which can be useful for Selenium testing.


The class property allows you to specify a cascading style sheet (CSS) class for the widget. This class will be applied to the widget in the browser and the widget will get the corresponding styling. The class should be a class from the theme that is used in the project. It overrules the default styling of the widget.


The style property allows you to specify additional CSS styling. If a class is also specified, this styling is applied after the class.

Tab index

The tab index influences the order in which the end user navigates through the page using the tab key. By default tab indices are zero and the tab order is determined automatically by the client system. A value of minus one (-1) means that the widget will be skipped when tabbing through the page.

Default value: 0

General properties


Choose the region that should be collapsed/expanded by clicking this button.

LeftThe left region of the layout container will be toggled.
RightThe right region of the layout container will be toggled.
_Default value:_ Left ### Mode Determines how the region will be toggled.
Push content asideThe sidebar moves the rest of the content off-screen (only available mode in Mendix 5.17 and older).
Slide over contentThe sidebar moves over the content.
Shrink contentThe content shrinks to make space for the sidebar.

Initially open

Only applicable if the mode is “Shrink content”.

Visibility properties


By default, whether or not an element is displayed in the browser is determined by how the page is designed and the user’s roles within the application. However, the page can be configured to hide the element unless a certain condition is met. 

Attribute Condition


When checked, this setting hides the widget unless a particular attribute has a certain value. Only boolean and enumeration attributes can be assigned to this purpose.

A practical example would be a web shop in which the user must submit both billing and delivery information. In this case you might not wish to bother the user with a second set of address input fields unless he or she indicates that the billing and delivery address are not the same. You can accomplish this by making the delivery address fields conditionally visible based on the boolean attribute SameBillingAndDeliveryAddress.

Module roles 

Module role conditional visibility is split into three subcategories.

for applicable rolesAll access determined by page and microflow access is maintained. For instance; if the user does not have access to the microflow triggered by a certain microflow button, that button will remain hidden from that user.
for all rolesThis setting overrides the setting above, rendering the element visible to all users, regardless of security settings. Note that this does not provide the user access to the restricted data, it merely unveils the element. In the example above, the microflow button would become visible, but clicking it would still result in a log-in page or error. 
for selected rolesThe widget can be made visible to a subset of the user roles available in your application. When activated, this setting will render the widget invisible to all users that are not linked to one of the selected user roles. Please note that this does not override project security. Any restrictions due to microflow, form, or entity access will remain in effect.