Modal
The Modal component is designed to render a modal dialog, providing a focused interface for users to complete a task or read information. The ModalContent component is used within Modal to structure the content of the modal, including the title, description and footer. The ModalTrigger component is used to render a trigger element that opens the Modal when clicked.
Usage Guidelines
Provide a clear and concise label for the ModalTrigger to indicate the purpose of the modal. Use the ModalContent component to structure the content of the modal, ensuring that each section is easily accessible and distinguishable.
<ModalTrigger> <Button>Open Modal</Button> <Modal> {({ close }) => ( <ModalContent title="Are you sure?" description="Updating this order will automatically send an invoice to the customer." footer={ <> <Button>Go back</Button> <Button>Continue</Button> </> } /> )} </Modal></ModalTrigger>Props
ModalTrigger Props
How the menu is triggered.
Whether the overlay is open by default (controlled).
Whether the overlay is open by default (uncontrolled).
Handler that is called when the overlay's open state changes.
Modal Props
The role of the dialog.
The children to render in the dialog.
When user interacts with the argument element outside of the overlay ref, return true if onClose should be called. This gives you a chance to filter out interaction with elements that should not dismiss the overlay. By default, onClose will always be called on interaction outside the overlay ref.
Whether the modal is currently performing an entry animation.
Whether the modal is currently performing an exit animation.
The container element in which the overlay portal will be placed. This may have unknown behavior depending on where it is portalled to. @deprecated - Use a parent UNSAFE_PortalProvider to set your portal container instead.
Whether to close the modal when the user interacts outside it.
Whether pressing the escape key to close the modal should be disabled.
Whether the overlay is open by default (controlled).
Whether the overlay is open by default (uncontrolled).
Handler that is called when the overlay's open state changes.
The CSS className for the element. A function may be provided to compute the class based on component state.
The inline style for the element. A function may be provided to compute the style based on component state.
A slot name for the component. Slots allow the component to receive props from a parent component.
An explicit null value indicates that the local props completely override all props received from a parent.