How to insert line break in p:tooltip

Community Driven Extensions Project
Post Reply
Posts: 1
Joined: 05 Jul 2012, 15:24

05 Jul 2012, 17:29


Is there a way to insert a line break in the text of a tooltip?

Thank you in advance.

User avatar
Expert Member
Posts: 3803
Joined: 02 Oct 2009, 09:41
Location: Germany, Black Forest

06 Jul 2012, 09:30

Sure, why not. You can use not escaped text inside pe:tooltip

Code: Select all

<pe:tooltip for="...">
    <h:outputText value="My first line <br/> My second line" escape="false" />
PrimeFaces Cookbook (2. edition): Learning Angular UI Development with PrimeNG: ... th-primeng Blog:

Posts: 20
Joined: 29 Mar 2011, 10:11
Location: Austria, Upper Austria

12 May 2013, 20:27

Hello, what tooltip are you using?
I m using <p:tooltip> when i want to enter some code like < it says i m not allowed to. Is it possible to get a linebreak in this one too?

Best Regards
Austrian Student, learning Primefaces
Primefaces 4.0
JSF 2.2
Glassfish 4.0

Posts: 2
Joined: 13 May 2013, 03:21

13 May 2013, 03:25

Just ran into the same problem myself, moessi. I managed to solve it by using two h:outputText tags with a br tag between them.

Code: Select all

<p:tooltip for="...">
  <h:outputText value="My first line" escape="false" />
  <br />
  <h:outputText value="My second line" escape="false" />
My guess would be that you can put a number of things inside the p:tooltip tag, but I haven't tried and don't know for certain what is/isn't supported.

Expert Member
Posts: 9607
Joined: 17 Jun 2010, 13:34
Location: Netherlands

17 May 2013, 18:21

This is the extensions forum for pe:tooltip. If you use p:tooltip, use the core forum...

Posts: 1
Joined: 12 Jun 2013, 08:01

12 Jun 2013, 08:06

It works with <p:tooltip> too if the "p" is defined as 'xmlns:p=""' which is your case, I think.
Just put <h:outputText> into your tooltip as suggested above by Oleg.

Post Reply

Return to “Extensions”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 1 guest