Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.
SOLVED

Component name is missing when we drag and drop in Page

Avatar

Level 5

Hi Team, 

I've developed custom component like the below, it's not showing the name of the component when we drag and drop. Like it should display like a Title component. In the below image the date picker should also come like title on page.

Tessa_learner1_0-1671689781984.png

 

Thanks

 

1 Accepted Solution

Avatar

Correct answer by
Employee Advisor

Hi @Tessa_learner1 ,

 

Looks like you do not have any placeholder text display logic for your component.

 

You need to add a placeholder in your component HTL to display it. This will be displayed as default when nothing is configured in the dialog (which is the case when you first drag and drop)

You can use /apps/core/wcm/components/commons/v1/templates.html 

 

 

 

<div data-sly-use.model="yourmodel"
     data-sly-use.templates="core/wcm/components/commons/v1/templates.html"

<sly data-sly-call="${templates.placeholder @ isEmpty = ${model.isEmpty}, classAppend='cmp-text'}"></sly>

 

 

 

If there is no sling model for your component, you can check the property directly on HTL as well.

 

For reference implementation, you can check components like "/apps/core/wcm/components/text/v2/text"

 

Regards,

Nitesh

 

View solution in original post

2 Replies

Avatar

Correct answer by
Employee Advisor

Hi @Tessa_learner1 ,

 

Looks like you do not have any placeholder text display logic for your component.

 

You need to add a placeholder in your component HTL to display it. This will be displayed as default when nothing is configured in the dialog (which is the case when you first drag and drop)

You can use /apps/core/wcm/components/commons/v1/templates.html 

 

 

 

<div data-sly-use.model="yourmodel"
     data-sly-use.templates="core/wcm/components/commons/v1/templates.html"

<sly data-sly-call="${templates.placeholder @ isEmpty = ${model.isEmpty}, classAppend='cmp-text'}"></sly>

 

 

 

If there is no sling model for your component, you can check the property directly on HTL as well.

 

For reference implementation, you can check components like "/apps/core/wcm/components/text/v2/text"

 

Regards,

Nitesh

 

Avatar

Level 5

Hi @nitesh_kumar  

Thank you so much for your reply. Yes I haven't added template and placeholder, after adding it I can able to view the component name as a placeholder. 

 

Thank you.