Home » Primefaces Dialog

PrimeFaces Dialog

It is a panel component which can overlay other elements on page. It is used to create a pop-up that can be used to display other elements too. It provides two methods show() and hide() to manage visibility of the component.

The <p:dialog> is used to create dialog box in JSF application. It also has various attributes that are tabled below.

Dialog Attributes

Attribute Default value Type Description
header null String It is used to set text of the header.
draggable true Boolean It specifies draggability.
resizable true Boolean It specifies resizability.
modal false Boolean It enables modality.
visible false Boolean When enabled, dialog is visible by default.
width auto Integer It is used to set width of the dialog.
height auto Integer It is used to set height of the dialog.
minWidth 150 Integer It is used to set minimum width of a resizable dialog.
minHeight 0 Integer It is used to set minimum height of a resizable dialog.
style null String It is used to set inline style of the dialog.
showHeader true Boolean It defines visibility of the header content.
positionType fixed String It defines whether dialog will be kept in viewport on scroll or keep its position.
responsive false Boolean It is used to make component responsive.
footer null String It is used to set text of the footer.

Example

Here, in the following example, we are implementing <p:dialog> component. This example contains the following files.

JSF File

// dialog.xhtml

Output:

PrimeFaces Dialog 1
PrimeFaces Dialog 2

Next Topic#

You may also like