Page 1 of 1

Formlayout Label align right

Posted: 06 Sep 2021, 07:56
by raho
Hello Primefaces Community,

I am using Rain and have the requirement to right-align the text of my labels.

So as shown in the demo page of the formlayout (https://primefaces.org/rain/formlayout.xhtml) I want that the labels in the Horizonatal example are right-aligned.

I know that I can use panelGrid (which renders html tables) to get right-aligned label text, but is panelGrid recommended to achieve this?

Regards, Rainer

Re: Formlayout Label align right

Posted: 10 Sep 2021, 10:32
by siris
Hi,

You can use "p-justify-end" styleClass for right aligned items. For example:

Code: Select all

                <div class="card ui-fluid">
                    <h5>Horizontal</h5>
                    <div class="p-field p-grid">
                        <p:outputLabel for="name3" styleClass="p-col-12 p-mb-2 p-md-2 p-mb-md-0 p-justify-end">Name</p:outputLabel>
                        <div class="p-col-12 p-md-10">
                            <p:inputText id="name3" />
                        </div>
                    </div>
                    <div class="p-field p-grid ">
                        <p:outputLabel for="email3" styleClass="p-col-12 p-mb-2 p-md-2 p-mb-md-0 p-justify-end">Email</p:outputLabel>
                        <div class="p-col-12 p-md-10">
                            <p:inputText id="email3" />
                        </div>
                    </div>
                </div>
Best Regards,

Re: Formlayout Label align right

Posted: 14 Sep 2021, 07:54
by raho
Thank you for the hint to use "p-justify-end" styleClass - it works like expected!

Regards, Rainer

Re: Formlayout Label align right

Posted: 14 Sep 2021, 09:20
by siris
You are welcome!

Best Regards,