Package org.patternfly.component.modal


package org.patternfly.component.modal
Provides the PatternFly modal dialog component and its subcomponents.

A modal is a dialog box that overlays the main content of the page, requiring the user to interact with it before returning to the parent application. Modals can contain headers with titles and descriptions, a scrollable body, and a footer with action buttons.

Usage

import static org.patternfly.component.button.Button.button;
import static org.patternfly.component.modal.Modal.modal;
import static org.patternfly.component.modal.ModalBody.modalBody;
import static org.patternfly.component.modal.ModalFooter.modalFooter;

Modal modal = modal()
        .addHeader("Basic modal")
        .addBody(modalBody()
                .text("Modal body content"))
        .addFooter(modalFooter()
                .addButton(button("Confirm").primary())
                .addButton(button("Cancel").link()))
        .appendToBody();
modal.open();
Modals can include a header with title and description:
import static org.patternfly.component.button.Button.button;
import static org.patternfly.component.modal.Modal.modal;
import static org.patternfly.component.modal.ModalBody.modalBody;
import static org.patternfly.component.modal.ModalFooter.modalFooter;
import static org.patternfly.component.modal.ModalHeader.modalHeader;

Modal modal = modal()
        .addHeader(modalHeader()
                .addTitle("Modal with description")
                .addDescription("A description provides more context about the modal."))
        .addBody(modalBody()
                .text("Modal body content"))
        .addFooter(modalFooter()
                .addButton(button("Confirm").primary())
                .addButton(button("Cancel").link()))
        .appendToBody();
See Also: