# Aura Components Style Guide Naming convention: - Upper camel case everything - Apex controllers should be named as: [Aura Component Name] + ['AuraController'] - e.g.: CardDisplayAuraController.apxc Comment Sectioning - Note: - Wrap blocks of element specific markup in comments to denote what they are on the website ``` <div class="slds-grid"> <!-- Beginning of first column --> <div class="slds-col"> <c:Component/> </div> <!-- Beginning of first column --> <!-- Beginning of second column --> <div class="slds-col"> <c:Component/> </div> <!-- End of second column --> </div> ``` Note: - Two empty lines of code included in-between each column section to help with readability 1. - Use shift + tab within the developer console to help auto-indent all of your markup properly <br/> Inline Styling - - **Inline Styling should be avoided whenever possible. Inline styling can cause significant problems across large code bases. - **If there is a specific use case in which inline styling can not be avoided, please communicate this to the project team. Note: - There should not be a space in-between the colon and value - There should be a space seperating each property-value pair ``` <apex:commandButton value="example" style="border:none; background:pink; color:#7C5B3E;"/> ``` Events - Note: - Naming should follow verb-noun format ending with 'Event' - Should be inline if no attributes needed - If attributes are needed, have them be inline **Inline event with no attributes:** ``` <aura:event type="APPLICATION" name="DoSomething"/> ``` ** Avoid application events as much as possible, consult with team if this is absolutely necessary <br/> **Event with inline attributes:** ``` <aura:event type="COMPONENT" name="DoSomething"> <aura:attribute name="someAttribute" type="String"/> </aura:event ``` <br/> Client-Controller Logic - All business logic should take place within a helper class, which specifies methods that are called on by individual controllers. # Header Classes should have a header with the name of person who created the class and a description of what the class does ``` ///////////////////////////////////////////////////// // // Name: Some Class // Author: Some Author // Description: Some description // /////////////////////////////////////////////////// ```