Hello @johnhenao10 -
To make your custom component act as a container and include other components instead of just the Text component, you can modify the markup and use the appropriate resource type for the desired component.
Here's an example of how you can modify your custom component to act as a container and include other components:
<div class="custom-component">
<h2>Custom header</h2>
<div data-sly-resource="${'path/to/your/component' @ resourceType='your/component/resourceType'}"></div>
</div>
In the above example, you can replace 'path/to/your/component' with the path to your desired component and 'your/component/resourceType' with the resource type of that component. By doing so, you can include any component of your choice within your custom component.
For example, if you want to include the Image component from the Core Components library, you can modify the markup as follows:
<div class="custom-component">
<h2>Custom header</h2>
<div data-sly-resource="${'path/to/image/component' @ resourceType='core/wcm/components/image/v2/image'}"></div>
</div>
Summarizing you actual question here :
So, while including the component, you are still referencing the specific path to the component's resources in the AEM repository. However, the resource type is used by AEM to identify and render the component dynamically during runtime. The resource type provides flexibility, reusability, and decoupling benefits, as explained in the previous response.