how to fix width and height of primefaces dialogbox

Try this, use a attribute style (or styleclass):

<p:dialog ... modal="true" style="width:50% !important; height:40% !important; top:25% !important; left: 30% !important;">
  <!-- any components -->
</p:dialog>

See more here.


You can use following code to make it of fixed dimension,

<p:dialog header="Modal Dialog" widgetVar="dlg2" modal="true" width="300" height="200">  
    <h:outputText value="This is a Modal Dialog." />  
</p:dialog>    

and to make minimize functionality. you can play with javascript to get it done.

See Also

  • Primefaces Show case

If you are using p-dialog, then you will want to use the built-in styleClass attribute.

.my-style-class {
    width: 50%;
    height: 70%;
}
<p-dialog styleClass="my-style-class"><p-dialog>