In Chapter 2, I introduced kinds and inheritance. It should come as no surprise that Enyo makes good use of those features by providing a rich hierarchy of kinds you can use and build upon in your apps. In this chapter, I’ll focus on two important kinds that Enyo provides: controls and components. I’ll also touch on some of the other kinds that you’ll need to flesh out your app.
Components introduce one of the most-used features of Enyo apps: the ability to create kinds composed of other kinds. This ability to compose new components from other components is one of the key features that encapsulation allows. Most kinds you’ll use, including the base app kind, will be based upon
Component or one of its descendants.
Composition is a powerful feature that lets us focus on breaking down the functionality of our app into discrete pieces and then combine those pieces together into a unified app. We used this feature in Chapter 1 when we built a traffic light out of three individual lights. Each descendant of
Component has a
components block that takes an array of component definitions.
We are not restricted to composing within new kinds. Many of the components that Enyo supplies were designed as containers for other components. We’ll cover many of the kinds that are designed to hold other components in Chapter 4. Some kinds, such as
Button, weren’t intended to contain other components.
Components introduce ...