Newer Version Available

This content describes an older version of this product. View Latest

What is Inherited?

This topic lists what is inherited when you extend a definition, such as a component.

Component Attributes

All attributes are inherited. You can override an attribute in a sub-component using <aura:attribute>. However, you should only do this if you want to change the attribute's default value in the sub-component.

Use <aura:set> in a sub-component to set an attribute in a super component when you are extending a component or implementing an interface.

Events

A child component that extends a super component can handle events fired by the super component. The child component automatically inherits the event handlers from the super component.

The super and sub-component can handle the same event in different ways by adding an <aura:handler> tag to the child component. The framework doesn't guarantee the order of event handling.

When an event fires, handlers for the event are executed. Handlers for any event that extend the event are also fired.

Helpers

A child component's helper inherits the methods from the helper of its super component. A child component can override a super component's helper method by defining a method with the same name as an inherited method.

Controllers

A child component that extends a super component can call actions in the super component's client-side controller. For example, if the super component has an action called doSomething, the child component can directly call the action using the {!c.doSomething} syntax.

We don't recommend using inheritance of client-side controllers as this feature may be deprecated in the future to preserve better component encapsulation. We recommend that you put common code in a helper instead.

Note

Models Are Not Inherited

A component's model is not inherited by a component that extends the super component.