Modal box is a component used to build modals.

ExamplesDocumentationCSS Variables


Copied to clipboard
Copied to clipboard
Copied to clipboard
Copied to clipboard



A modal box is a generic rectangular container that can be used to build modals. A modal box can have three sections: header, body, and footer. Header or body is required. If no .pf-c-title is used, aria-label="[title of modal]" must be provided for .pf-c-modal-box.


Attribute Applies to Outcome
role="dialog" .pf-c-modal-box Identifies the element that serves as the modal container. Required
aria-labelledby="[id value of .pf-c-title]" .pf-c-modal-box Gives the modal an accessible name by referring to the element that provides the dialog title. Required when .pf-c-title is present
aria-label="[title of modal]" .pf-c-modal-box Gives the modal an accessible name. Required when .pf-c-title is not present
aria-describedby="[id value of applicable content]" .pf-c-modal-box Gives the modal an accessible description by referring to the modal content that describes the primary message or purpose of the dialog. Not used if there is no static text that describes the modal.
aria-modal="true" .pf-c-modal-box Tells assistive technologies that the windows underneath the current modal are not available for interaction. Required
aria-label="Close" .pf-c-modal-box__close .pf-c-button Provides an accessible name for the close button as it uses an icon instead of text. Required
aria-hidden="true" Parent element containing the page contents when modal is open Hides main contents of the page from screen readers. The element with .pf-c-modal-box must not be a descendent of the element with aria-hidden="true". For more info see trapping focus. Required


Class Applied Outcome
.pf-c-modal-box <div> Initiates a modal box. Required <button> Initiates a modal box close button. Required
.pf-c-title <h1>,<h2>,<h3>,<h4>,<h5>,<h6> Initiates a title. Always use it with a modifier class.
.pf-c-modal-box__body <div> Initiates a modal box body. A modal box body is required if there is no modal box header.
.pf-c-modal-box__footer <footer> Initiates a modal box footer.
.pf-m-sm .pf-c-modal-box Modifies for a small modal box width.
.pf-m-lg .pf-c-modal-box Modifies for a large modal box width.

CSS Variables

--pf-c-modal-box--BoxShadowc_modal_box_BoxShadow0 0.1875rem 0.4375rem 0.1875rem rgba(3,3,3,.13),0 0.6875rem 1.5rem 1rem rgba(3,3,3,.12)
--pf-c-modal-box--MaxHeightc_modal_box_MaxHeightcalc(100vh - 3rem)
--pf-c-modal-box--MaxWidthc_modal_box_MaxWidthcalc(100% - 2rem)
--pf-c-modal-box__footer--c-button--sm--MarginRightc_modal_box__footer_c_button_sm_MarginRightcalc(1rem / 2)
--pf-c-modal-box--body--MinHeightc_modal_box_body_MinHeightcalc(1rem * 1.5)
--pf-c-modal-box--c-button--Topc_modal_box_c_button_Topcalc(2rem - 0.375rem + 0.0625rem)