Newer Version Available
Lightning Page Template Component Best Practices
Keep these best practices and limitations in mind when creating Lightning page
template components.
- Don’t add custom background styling to a template component. It interferes with Salesforce’s Lightning Experience page themes.
- Including scrolling regions in your template component can cause problems when you try to view it in the Lightning App Builder.
- Custom templates can’t be extensible nor extended—you can’t extend a template from anything else, nor can you extend other things from a template.
- Using getters to get the regions as variables works at design time but not at
run time. Here’s an example of what we
mean.
1<aura:component implements="lightning:appHomeTemplate"> 2 <aura:attribute name="region" type="Aura.Component[]" /> 3 <aura:handler name="init" value="{!this}" action="{!c.init}" /> 4 5 <div> 6 {!v.region} 7 </div> 8 9</aura:component>1{ 2 init : function(component, event, helper) { 3 var region = cmp.get('v.region'); // This will fail at run time. 4 ... 5 } 6} - You can remove regions from a template as long as it’s not being used by a Lightning page, and as long as it’s not set to access=global. You can add regions at any time.
- A region can be used more than once in the code, but only one instance of the region should render at run time.
- A template component can contain up to 25 regions.