ModalConfirm
ModalConfirm
is a convenience wrapper on top of Modal
. It is intended to use for showing confirmation dialogs.
Import
import { ModalConfirm } from '@contentful/f36-components';// orimport { ModalConfirm } from '@contentful/f36-modal';
Code examples
Props
- Name
children(required)
ReactNode - Name
isShown(required)
DescriptionWhen true, the dialog is shown.
falsetrue - Name
onCancel(required)
DescriptionFunction that will be called when the cancel button is clicked. This does not close the ModalConfirm.
(event: MouseEvent<Element, MouseEvent> | KeyboardEvent<Element>) => void - Name
onConfirm(required)
DescriptionFunction that will be called when the confirm button is clicked. This does not close the ModalConfirm.
() => void - Name
allowHeightOverflow
DescriptionAre modals higher than viewport allowed
Defaultfalsetruefalse - Name
cancelLabel
DescriptionLabel of the cancel button
DefaultstringfalseCancel - Name
cancelTestId
Defaultstringcf-ui-modal-confirm-cancel-button - Name
confirmLabel
DescriptionLabel of the confirm button
DefaultstringfalseConfirm - Name
confirmTestId
Defaultstringcf-ui-modal-confirm-confirm-button - Name
initialFocusRef
DescriptionOptional property to set initial focus
RefObject<HTMLElement> - Name
intent
DescriptionThe intent of the ModalConfirm. Used for the Button.
Default"primary""positive""negative"positive - Name
isConfirmDisabled
DescriptionWhen true, the confirm button is set to disabled.
Defaultfalsetruefalse - Name
isConfirmLoading
DescriptionWhen true, the confirm button is set to loading.
Defaultfalsetruefalse - Name
modalContentProps
DescriptionOptional props to override ModalContent behaviour
Partial<ModalContentProps> - Name
modalControlsProps
DescriptionOptional props to override ModalControl behaviour
Partial<ModalControlsProps> - Name
modalHeaderProps
DescriptionOptional props to override ModalHeader behaviour
Partial<ModalHeaderProps> - Name
shouldCloseOnEscapePress
DescriptionBoolean indicating if pressing the esc key should close the overlay.
Defaultfalsetruetrue - Name
shouldCloseOnOverlayClick
DescriptionBoolean indicating if clicking the overlay should close the overlay.
Defaultfalsetruetrue - Name
size
DescriptionSize of the modal window
Defaultstringnumbermedium - Name
testId
Defaultstringcf-ui-modal-confirm - Name
title
DescriptionModal title that is used in header
DefaultstringAre you sure?