Modal
A dialog that appears on top of the main content.
A Modal is a dialog that appears on top of the main content. It has a header
with a title, optional subtitle and icon, a body, and an optional footer, and
fades in and out via the Base UI transition lifecycle.
import { Button, Modal } from '@workflowbuilder/ui';import { useState } from 'react';
function Example() { const [open, setOpen] = useState(false); return ( <> <Button variant="primary" onClick={() => setOpen(true)}> Open modal </Button> <Modal open={open} onClose={() => setOpen(false)} title="Example modal" subtitle="Rendered live from @workflowbuilder/ui" footer={ <Button variant="primary" onClick={() => setOpen(false)}> Got it </Button> } > Modal body content. </Modal> </> );}
Also accepts every standard <div> attribute (onChange, placeholder, aria-*, …); they are forwarded to the underlying element.
openrequiredControls the visibility of the modal
titlerequiredTitle displayed in the modal header
childrenContent to be displayed in the modal body
closeLabelAccessible label for the close button
footerContent to be displayed in the modal footer
footerVariantVariant of the footer styling
iconIcon the component shows; `IconSwitch` shows it in the off state.
onCloseCallback function called when the modal is closed
sizeSize variant of the modal
subtitleOptional subtitle displayed below the title
CSS variables
Section titled “CSS variables”Color
--wb-public-modal-background--wb-public-modal-backdrop-background--wb-public-modal-header-background--wb-public-modal-header-border-color--wb-public-modal-title-color--wb-public-modal-description-color--wb-public-modal-icon-background--wb-public-modal-icon-color--wb-public-modal-content-background--wb-public-modal-footer-border-colorSize
--wb-public-modal-width--wb-public-modal-border-radius--wb-public-modal-padding--wb-public-modal-description-size--wb-public-modal-description-line-height--wb-public-modal-icon-padding--wb-public-modal-content-padding--wb-public-modal-footer-padding--wb-public-modal-large-width--wb-public-modal-large-padding--wb-public-modal-large-title-size--wb-public-modal-large-title-line-height--wb-public-modal-large-icon-padding--wb-public-modal-box-shadow--wb-public-modal-gap--wb-public-modal-gap-large--wb-public-modal-icon-border-radius--wb-public-modal-icon-border-radius-large--wb-public-modal-content-gap