Site icon Pro Liferay

Liferay Alloy UI

liferay alloy ui

 

Aim of this Article:

Liferay AUI Taglib provides various tag for faster UI development. This article explains the different liferay alloy ui tags and its uses.

 

 

 

In the left these are the available aui tags which are ready to use in our code. Most widely used tags are

aui:form

aui:input

aui:button

aui:model-context

 

 

Form Tag(aui:form):

As the name itself indicates this tag is used to create the form.  For example

<aui:form name="fm" action="some-url" method="post" cssClass="" onSubmit="">
</aui:form>

Attributes:

 

aui:input tag:

Look the below code

<aui:form name="fm">
    <!-- By default inlineLabel is false -->
    <aui:input name="firstName"/>
    <aui:input name="middleName"/>
    <aui:input name="lastName"/>
    
    <!-- inlineLabel is true -->
    <!-- used label attribute -->
    <aui:input  name="age" label="Age" inlineLabel="true"/>
    
    
    <!-- Use of prefix and suffix -->
    <aui:input  name="contact" label="" prefix="contact"/>
    <aui:input  name="email" label=""  suffix="email"/>
    
    
</aui:form>

Output


aui:layout and aui:column:

aui:layout:  Used to wrap columns (avoiding tables)

Attributes:cssClass: custom classes for additional styling

<aui:form name="fm">
    <!-- Use of aui:layout -->
    <!-- Use of aui:column -->
    <aui:layout>
        <aui:column columnWidth="25" first="true">
            <aui:input name="firstName"/>
            <aui:input name="middleName"/>
            <aui:input name="lastName"/>
        </aui:column>
        <aui:column columnWidth="5">
        </aui:column>
        <aui:column columnWidth="70" last="true">
            <aui:input name="age"/>
            <aui:input name="email"/>
            <aui:input name="contact"/>
        </aui:column>
    </aui:layout>
    
</aui:form>

Output

aui:field-wrapper

Used to wrap any other element in a form (radio elements, custom elements…). Below is the sample code 

<aui:field-wrapper name="firstSection" helpMessage="First Section is mandatory" label="First Section">
        <aui:input name="firstName"/>
        <aui:input name="middleName"/>
        <aui:input name="lastName"/>
    </aui:field-wrapper>
    
        <aui:field-wrapper name="secondSection" helpMessage="Enter all the fields" label="Second Section">
        <aui:input name="age"/>
        <aui:input name="email"/>
        <aui:input name="contact"/>
    </aui:field-wrapper>

Output

aui:button and aui:button-row:

<aui:form name="fm">
    <aui:field-wrapper name="firstSection" helpMessage="First Section is mandatory" label="First Section">
        <aui:input name="firstName"/>
        <aui:input name="middleName"/>
        <aui:input name="lastName"/>
    </aui:field-wrapper>
    <aui:button-row>
        <aui:button name="saveButton" type="submit" value="save"  />

        <aui:button name="cancelButton" type="button" value="cancel" />
    </aui:button-row>
</aui:form>

aui:model-context:

Used to set an object that will be accessed from fields in the form.
Attributes:

<aui:model-context bean="<%= user %>" model="<%= User.class %>" />


Note: To use those Liferay Alloy UI tag you must have below taglib in your portlet

<%@ taglib uri=”http://liferay.com/tld/aui” prefix=”aui” %>

 


 

 

http://www.liferay.com/web/guest/community/wiki/-/wiki/Main/Alloy+UI+Forms+%28aui%29

Exit mobile version