Sunday 23 October 2016

AEM Custom Text component in touch UI

AEM Custom Text component in touch UI with alignment and text color.

In this article we will see how to create custom text component in aem with custom dialog using CRXDE Lite.

Open CRXDE Lite , create a component folder in apps/. Right click on components folder Select Create –> Create Components.


Enter below details in the Create Component dialog : 
Label : customTextComponent 
Title : My Text Component
Description : My Text Component

Click Next till last screen and click OK on last Screen.
Click on Save All on top left of crxde to save the changes.

Now customTextComponent.jsp file created under this component.

Copy below code into the 'customTextComponent.jsp' file.

Now create touch ui dialog as below.
  • Right click on customTextComponent -> create Node.
  • Name 'cq:dialog' and Type 'nt:unstructured'


Now it will create .content.xml file under your project physical location (note: it won't show in crxde).
/myproject/jcr_root/apps/yourComponents_dir/yourCustomComponent/_cq_dialog/.content.xml

Open .content.xml and replace with below code.




Now create 'clientlib' folder with below properties.

  • Right click on 'customTextComponent' -> create Node.
  • Name 'clientlib' and Type 'cq:ClientLibraryFolder'


















Now add below properties for clientlib.
Select clientlib folder -> add properties 'categories' and 'dependencies' as below.











Now right click on clientlib folder > create folder 'css'
Now right click on clientlib folder > create file 'css.txt'
Copy below text and paste into 'css.txt'
#base=css
customTextcomponent.css

Now right click on 'css' folder -> create file 'customTextcomponent.css'
Copy below css and paste into 'customTextcomponent.css'.

Now integrate your customTextComponent in page.
Drag customTextComponent and open dialog.

















And your page will be like below.














Enjoy with your customTextComponent.!!!

Please comment if it's helpful or for any questions.