Formlayout Label align right

Post Reply
raho
Posts: 20
Joined: 05 Feb 2016, 21:08

06 Sep 2021, 07:56

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
PF 10.0.0
WildFly 22.0.1.Final

siris
Posts: 322
Joined: 29 Jul 2019, 13:57

10 Sep 2021, 10:32

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,

raho
Posts: 20
Joined: 05 Feb 2016, 21:08

14 Sep 2021, 07:54

Thank you for the hint to use "p-justify-end" styleClass - it works like expected!

Regards, Rainer
PF 10.0.0
WildFly 22.0.1.Final

siris
Posts: 322
Joined: 29 Jul 2019, 13:57

14 Sep 2021, 09:20

You are welcome!

Best Regards,

Post Reply

Return to “Rain - PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 4 guests