Custom Apex Class Types

An attribute can have a type corresponding to an Apex class. For example, this is an attribute for a Color Apex class:

<aura:attribute name="color" type="docSampleNamespace.Color" />

When an instance of an Apex class is returned from a server-side action, the instance is serialized to JSON by the framework. Only the values of public instance properties and methods annotated with @AuraEnabled are serialized and returned.

Using Arrays

If an attribute can contain more than one element, use an array.

This aura:attribute tag shows the syntax for an array of Apex objects:

<aura:attribute name="colorPalette" type="docSampleNamespace.Color[]" />