Creating Maintainable Interfaces with Snippets
Creating Maintainable Interfaces with Snippets by Arjan van IJzendoorn
Snippets are reusable interface parts that allow you to create a more maintainable interface. If you use a snippet in multiple pages, you only have to make a change once and the result will show up everywhere. For example, you can create a snippet with some navigation links that you then show on several pages. If you make a change in the snippet, all pages will benefit.
We want to highlight one final use case for snippets. Because layouts are intended to specify what comes where, we limit what kind of widgets can be inserted into them. For instance, data widgets, such as a data view, are not available for use in a layout. However, there can be use cases for having a data view in a layout, for example for showing the name of the current user. Since layouts can include snippets and snippets can include data widgets, we recommend including a snippet on a layout to address these use cases.
To summarize, snippets help you structure the user interface of your application and save development time by consolidating shared content in one place. Combine this with layouts and Mendix 5 offers a lot more power when designing your apps.
Next up, we will take a look at styling Mendix 5 apps.