Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

How to add formatting functionality to text field in our component in aem

Babita11
Level 2
Level 2
 
1 Accepted Solution
SivaPrasadReddyS
Correct answer by
Level 8
Level 8

There is no limitation for that, you can use richtext field where ever you want. 

 

Please check below example where you can find dialog structure for richtext which is included at tab level:

https://gist.github.com/briankasingli/1a7e3e12deaa2e076645b09d30039b46

 

View solution in original post

6 Replies
SivaPrasadReddyS
Level 8
Level 8

Your question is not clear to me, but if you're exploring options to add formatting features , please explore on RTE which will help on you: 

 

https://experienceleague.adobe.com/docs/experience-manager-core-components/using/components/text.htm...

Hope this helps you to understand further.

Babita11
Level 2
Level 2

Hi sir, actually I created a component in that i had three fields name as image field, title field and description field, I want description text had alignment like left, right or centered. How can I had formatting property to that description text field. Can you suggest something about this

SivaPrasadReddyS
Level 8
Level 8

If you wanted to have formatting capabilities, YES you need to suggest Richtext field option. 

when you added richtext type filed, by default you will see some formatting plugins, and more can added /customised based on requirements.

please have a look at this as well so that you can quickly change field resource type on your local and see how it looks like.

https://gist.github.com/mattlo/d9f699e8142e00df99747772f3a486ba 

Babita11
Level 2
Level 2

My expectation was to create a tab in the dialog where user can select where the description has to display .. like completely left , middle and right

SivaPrasadReddyS
Correct answer by
Level 8
Level 8

There is no limitation for that, you can use richtext field where ever you want. 

 

Please check below example where you can find dialog structure for richtext which is included at tab level:

https://gist.github.com/briankasingli/1a7e3e12deaa2e076645b09d30039b46

 

View solution in original post

Vijayalakshmi_S
Community Advisor
Community Advisor

@Babita11 

Check if you are looking for something like the below

  • Have a select field to capture the description position from content author (Left, right, center as options of select field)
  • In HTL, align the description based on the value of above select field via CSS (either class attribute or inline styling)

Sample screenshots :

Vijayalakshmi_S_0-1636472531744.png

In HTL, 

<p style="text-align: ${properties.position @ context='styleToken'}">${properties.description ?  properties.description : 'Default Description'}</p>

If it is deviating from your requirement, please elaborate with screenshots if possible.