You are currently viewing outdated (<=3.x) Chameleon documentation on our old website. For version >=4.x, check out our new website.

Current release: 3.5.0 | hub

components

Dialog (code)

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

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

Props

NameTypeDefaultRequiredDescription
accessibilityLabelCloseButtonString'Close'-The A11Y label set in the close button
childrenNode--The content of the Dialog
closeOnBackdropClickBooleantrue-User can hide the dialog by clicking on the backdrop.
closeOnEscapeBooleantrue-User can hide the dialog by pressing `Escape`.
footerNode--Contents of the footer
headerHiddenBooleanfalse-Hide the Dialogs header
lockBodyOnScrollBooleantrue-User can't scroll on body when the dialog is visible.
onCloseFunction--The close event is triggered
showBooleanfalse-Show or hide the Dialog

Header hidden

default: false

If you don't want a header at the top of the dialog, you can set the headerHidden prop. Hiding the header, will also remove the x button that can be used to close the modal. If you want an uncloseable modal, you can combine this with closeOnBackdropClick and closeOnEscape.

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

If you want a footer at the bottom of the dialog, you can set the footer prop.

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

Ways to close

closeOnBackdropClick default: true

closeOnEscape default: true

By default, the dialog can be closed by pressing the x button, by hitting the escape key or by clicking the backdrop. You can granularly disable these options.

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

Lock body on scroll

default: true

When a Dialog is open, scrolling the body is disabled. If you want a user to still be able to scroll the body when a Dialog is open, you can disable this prop.

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

© Copyright 2020 Mediahuis NV. All rights Reserved