Placeholders in snippets - Mendix Forum

Placeholders in snippets


It would be nice to define placeholders in snippets. So there is room inside the snippet for the caller of the snippet to do extra stuff. Sometimes I create almost duplicate pages/snippets only because there needs to be a button somewhere between the rest of the snippet.

As an extra it would be nice, inside that placeholder, to be able to use the context of the caller of the snippet as a parameter for a microflow.

7 answers

I coudn't agree more with placeholders in Snippets. I think it's one of the most important features Mendix could implement in order to become more modular. The lack of options here is one of the major reason you're forced to create technical debt by copy pasting things that shouldn't be duplicated. It will allow all kinds of excellent improvements:

  • Creating page titles, title bars and other layout elements that can be re-used and defined once. No more inconsitencies, or editng 100s of pages when you want to change some basic styling and/ or add some functionality. This component way of working is already the defacto method for almost every modern frontend library like React, Angular and Vue and for good reason.
  • Creating re-usable plug and play components. Think interactive master detail pages, a custom collapsable groupbox, a chat functionalitiy, a datagrid that has multiple versions all purely in Mendix. Basically creating re-usable “widgets” in pure Mendix by defining a snippet. 
  • Defining snippet components in a design system. This can be done in a company module that is used in all applications. Want to change somthing company wide? Just change the appropiate snippet once.
  • Really I could go on and on about this.

Offcourse I know about building blocks but everytime I use one I'm like there is some additional technical debt for you. 


this sound a lot like the idea for “building blocks2”

where you have the placeholders like in layouts where you can add page specific elements.

also having the ability to update the building blocks in a central location.

I also think tools such as Figma do a great job of what you can or cant change in an “instance” of an asset.


Also please allow islands inside of the placeholder. example, snippet has a placeholder. And that placeholder has an island where the original snippet can continue to add stuffs.


yes this would be handy!


Do something with this! 3 months ago, someone requested the same, it is still wanted so bad!


By doing so, Snippets could almost turn into whole blocks of functionality and yes, please do that. 

We work with a lot of manual components and prefer to use list views with our own filters, instead of datagrids. A layout grid, a few containers and some classes that every time have to be copied. If we could just reuse the same snippet and use different input fields, then everything would be so much easier and our product must more consistent with our more effort. 


Excellent idea, this would be very useful for certain projects!