widgetlist attribute contains several widgets of different types, each based on an individual class with its set of attributes, rendered by an individual component. In general, widgets are independent of the container widget they live in (the
widgetlist attribute) and vice versa. This reduces coupling, which is good.
However, sometimes there’s business logic requiring a container widget and the widgets it contains to be coupled more tightly, making it necessary to pass props from the container down to the widgets inside. If, for example, an
EmployeeListWidget allowed to contain only instances of the
EmployeeListItemWidget type acts as the data source of the latter widgets, it can communicate this piece of information to them via the
widgetProps property. The props included in
widgetProps are passed individually to the contained widgets, along with the
widget prop provided by Scrivito. Here’s an example of how the “employee list” use case could be implemented: