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
- Namechildren(required)ReactNode
- NameisShown(required)DescriptionWhen true, the dialog is shown. falsetrue
- NameonCancel(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
- NameonConfirm(required)DescriptionFunction that will be called when the confirm button is clicked. This does not close the ModalConfirm. () => void
- NameallowHeightOverflowDescriptionAre modals higher than viewport allowed Defaultfalsetruefalse
- NamecancelLabelDescriptionLabel of the cancel button DefaultstringfalseCancel
- NamecancelTestIdDefaultstringcf-ui-modal-confirm-cancel-button
- NameconfirmLabelDescriptionLabel of the confirm button DefaultstringfalseConfirm
- NameconfirmTestIdDefaultstringcf-ui-modal-confirm-confirm-button
- NameinitialFocusRefDescriptionOptional property to set initial focus RefObject<HTMLElement>
- NameintentDescriptionThe intent of the ModalConfirm. Used for the Button. Default"primary""positive""negative"positive
- NameisConfirmDisabledDescriptionWhen true, the confirm button is set to disabled. Defaultfalsetruefalse
- NameisConfirmLoadingDescriptionWhen true, the confirm button is set to loading. Defaultfalsetruefalse
- NamemodalContentPropsDescriptionOptional props to override ModalContent behaviour Partial<ModalContentProps>
- NamemodalControlsPropsDescriptionOptional props to override ModalControl behaviour Partial<ModalControlsProps>
- NamemodalHeaderPropsDescriptionOptional props to override ModalHeader behaviour Partial<ModalHeaderProps>
- NameshouldCloseOnEscapePressDescriptionBoolean indicating if pressing the esc key should close the overlay. Defaultfalsetruetrue
- NameshouldCloseOnOverlayClickDescriptionBoolean indicating if clicking the overlay should close the overlay. Defaultfalsetruetrue
- NamesizeDescriptionSize of the modal window Defaultstringnumbermedium
- NametestIdDefaultstringcf-ui-modal-confirm
- NametitleDescriptionModal title that is used in header DefaultstringAre you sure?