<aura:component implements="lightning:actionOverride,force:hasRecordId,force:hasSObjectName"> <article class="slds-card"> <div class="slds-card__header slds-grid"> <header class="slds-media slds-media--center slds-has-flexi-truncate"> <div class="slds-media__body"> <h2><span class="slds-text-heading--small">Expense Details</span></h2> </div> </header> <div class="slds-no-flex"> <lightning:button label="Edit" onclick="{!c.handleEdit}"/> </div> </div> <div class="slds-card__body">(expense details go here)</div> </article> </aura:component>
In Lightning Experience, the standard Tab and View
actions display as a page, while the standard New and Edit actions display in an overlaid panel.
When used as action overrides, Lightning components that implement the lightning:actionOverride interface replace the standard behavior
completely. However, overridden actions always display as a page, not as a panel. Your component
displays without controls, except for the main Lightning Experience navigation bar. Your
component is expected to provide a complete user interface for the action, including navigation
or actions beyond the navigation bar.
Components you plan to use as action overrides usually need details about the object type they’re working with, and often the ID of the current record. Your component can implement the following interfaces to access those object and record details.
force:hasRecordId
Add the force:hasRecordId interface to a Lightning component to enable the component to be assigned the ID of the current record. The current record ID is useful if the component is used on a Lightning record page, as an object-specific custom action or action override in Lightning Experience or Salesforce1, and so on.
force:hasSObjectName
Add the force:hasSObjectName interface to a Lightning component to enable the component to be assigned the API name of current record’s sObject type. The sObject name is useful if the component can be used with records of different sObject types, and needs to adapt to the specific type of the current record.