Component name is missing when we drag and drop in Page | Community
Skip to main content
Level 4
Dec 22, 2022 6:16 AM UTC
Solved

Component name is missing when we drag and drop in Page

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.

 

Thanks

 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
nitesh_kumar-1
nitesh_kumar-1Accepted solution
Employee
Dec 22, 2022 6:51 AM UTC

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

 

2 replies

nitesh_kumar-1
nitesh_kumar-1Accepted solution
Employee
Dec 22, 2022 6:51 AM UTC

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

 

Translate
Level 4
Dec 22, 2022 11:24 AM UTC

Hi @nitesh_kumar-1  

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.

Translate