Skip to main content

Dialog: React

To draw attention of the user to a dedicated piece of content, you can use a Dialog.

Installation

Before you can start using the @mediahuis/chameleon-react component, you’ll need to install it, for more information check: Getting started for developers.

With that done, you’re now ready to implement the component in your application.

import { Dialog } from '@mediahuis/chameleon-react';

export default function Example() {
return <Dialog show={true}>Hello World</Dialog>;
}

Properties

PropertyTypeDefaultRequiredDescription
accessibilityLabelCloseButtonString'Close'NoSets the accessibility label for the close button.
allowOutsideClickBoolean | UnknownfalseNoIf set and is or returns true, a click outside the focus trap will not be prevented (letting focus temporarily escape the trap, without deactivating it), even if clickOutsideDeactivates=false. More info: https://github.com/focus-trap/focus-trap
childrenReactNode-NoThe content of the Dialog.
closeOnBackdropClickBooleantrueNoDetermines whether the user can hide the dialog by clicking on the backdrop.
closeOnEscapeBooleantrueNoDetermines whether the user can hide the dialog by pressing `Escape`.
footerReactNode-NoThe contents of the footer.
headerHiddenBooleanfalseNoHides the Dialog's header.
lockBodyOnScrollBooleantrueNoDetermines whether the user can scroll the document body when the dialog is visible.
onCloseFunction-NoThe event handler function triggered when the dialog is closed.
showBooleanfalseNoDetermines whether the Dialog is shown or hidden.