why we use snippets

why we use snippets and where do we use?
4 answers

Snippets define reusable interface parts. They can be used on both pages and layouts. By using snippets you can make changes in fewer places when you modify the interface. For example, you can have a snippet that is used both in the contents area of a template grid and in a data view. If you change something in the snippet, that change will show up in both places.

A snippet is indicated by a blue bar above a drop-zone. The blue bar has the snippet icon at the left and the name of an entity, if the snippet is in the context of an entity. If the snippet has no context, the bar says 

To know more about Snippet check the bellow link.



Hey Karthik,
Snippets are reusable interface parts that can be used on pages and layouts. Using snippets requires Mendix business engineers to modify fewer places in the interface and allows for a smoother transition as well as a user-friendly experience.

For example, you can have a snippet that is used both in the contents area of a template grid and in a data view. Changes you make to the snippet will be applied in all places where the snippet is used.

In addition, a snippet can define an entity that serves as a context for the widgets placed in it.

For example, if you set the Course entity for a snippet, you could place a text box showing the Course Title on the snippet without defining a data view first.

When an entity is defined on a snippet, it needs to be placed inside a context for that entity in each place where you use the snippet (for example, a data view).

Hope it helps!


I can also add to Rishabh answer: from security perspective, I found snippet very useful in the following senario. Let’s assume that you have a landing page where you have content from different other app modules. You can manage the content visibility using each module internal roles directly without any extra roles on the module that contains that landing page. 


Snippets define reusable interface parts. For an example, if you want to use the same data view into different place in you application, why you you complete the multiple steps to get the data view, define the data source and select the connected component. Create a reusable snippets interface which can be use in different place without any further efforts.


Please use following link for details information