Overlay vs Extend



Is there any advantage to overlaying components than just extending them using sling:resourceSuperType?

Overlay allows you to copy over libs components to apps and changing them without affecting the original component. Doesn't extending the component also allow the same - you can just overwrite the script where changes are required? In addition, extending can make it future-proof, that is, if you happen to upgrade AEM in the future, extending components will allow you to use the latest available components in /libs.

Or is there anything that can only be achieved using overlay that I'm missing here?

Thanks for any inputs here.

Accepted Solutions (1)

Accepted Solutions (1)





I basically prefer extending a component in AEM because, if you extend the component and setting the property sling:resourceSuperType to the particular path of the component and you can modify the component according to your project requirements.

Also - Once you upgrade your AEM to higher version, you can inherit the features of existing component from OOTB and you no need to manually make the changes.


And Overlays - Here you can copy the component from OOTB to your apps and make changes according to your project requirements. Here when you upgrade to higher version of AEM, you need to manually apply the changes(No inheritance from OOTB).

Here is the nice explanation as Scott provided: cq5 - overlay/overriding v/s extending of components in AEM - Stack Overflow

Hope this helps!!


Ratna Kumar.