A Lightning component is required to implement lightning:actionOverride interface to be used to override a standard action on an object. You can override the View, New, Edit, and Tab standard actions on most standard and all custom objects. By overriding standard actions, you can customize your org using Salesforce lightning components along with completely updating the method you view, edit and create new records.
Following are the steps to override standard buttons with lightning component:
1. Create lightning component
Here we have used force :showToast and force : navigateToSobject.
Force :showToast Displays a toast notification with a message.
A toast displays a message below the header at the top of a view. The message is specified by the message attribute.This toast displays for 5000ms, with a close button in the top right corner when the mode attribute is dismissible.
force : navigateToSobject Navigates to sObject record mentioned by recordId.
To display the record view, set the record ID on the recordId attribute and fire the event.
The record view contains slides that display the Chatter feed, the record details, and related information. This example displays the related information slide of a record view for the specified record ID.
2. Create apex controller for lightning component
3. Override standard button with lightning component.steps to follow:
a) Go to setup and click objectManager.
b) Select Account and click Buttons, Links and Actions.
c) Select new button and click edit.
d) Select your Lightning Component Bundle from dropdown and click save .
e) In the below screenshot you can see the new button has successfully override with lightning component.
f) Now on the click of new button on account a lightning component will open as it shows in below screenshot.