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
In the example below, the snippet is used in the context of the Orders.Order entity.
An example of snippet properties is represented in the image below:
Snippet properties consist of the following sections:
2.1 Common Section
For more information on properties in this section, see the Common Section section in Properties Common in the Page Editor.
2.2 Designer Section
2.2.1 Canvas Width
Canvas width defines the width in pixels of the page in the page editor. It is purely used for editing purposes; this property has no effect on the width of the page in the actual application.
Default value: 800
2.2.2 Canvas Height
Canvas height defines the preferred minimum height in pixels of the page in the page editor. It is purely used for editing purposes; this property has no effect on the height of the page in the actual application.
Default value: 600
2.3 General Properties
The values for the platform property are:
- Web (default) – these snippets are used for pages which are going to be displayed in a browser or hybrid mobile app
- Native – these snippets are used for pages which are going to be displayed in a native mobile app
This property defines the entity that is used as context for the widgets placed on this snippet.
Entity optionally specifies an entity that serves as the context for the widgets placed on it. When an entity is defined on a snippet, any usages of the snippet need to be placed inside a context for that entity or a specialization: a data view, for example.
For example, if you wanted to use an attribute of a Customer entity in a snippet, you could place a text box that shows the customer’s name in the snippet without having to define a data view first.