RUI.next

Feedback
Mask

Mask

Mask represents the background modal layer.

<Mask visible={visible} onClickMask={() => setVisible(false)} />
<Mask visible={visible} onClickMask={() => setVisible(false)} />

Example

Basic usage of Mask component (click screen to close mask).

Basic mask with default 55% opacity and bodyScroll disabled
Click to show background mask
Mask with content and bodyScroll enabled
Click to show mask with content

Showcase more usage of Mask component.

Dark mask - `opacity: 35%` (click screen to close mask)
Click to show dark mask with thin opacity
Dark mask - `opacity: 75%` (click screen to close mask)
Click to show dark mask with thick opacity
Dark mask - `opacity: 90%` (click screen to close mask)
Click to show dark mask with 90% opacity
White mask (click screen to close mask)
Click to show white mask

API

PropertiesDescriptionTypeDefault
afterCloseTriggered when completely closed() => void-
afterShowTriggered after fully displayed() => void-
colorColor of the mask'black' | 'white''black'
destroyOnCloseUninstall content when invisiblebooleanfalse
disableBodyScrollWhether to disable body scrollingbooleantrue
forceRenderRender content forcelybooleanfalse
getContainerTo get the specified mounted HTML node, if null returned, it would be rendered to the current nodeHTMLElement | () => HTMLElement | nullnull
onClickMaskTriggered when the mask is clicked(event: React.MouseEvent<HTMLDivElement, MouseEvent>) => void-
opacityOpacity'default' | 'thin' | 'thick' | number'default'
stopPropagationStop the propagation of some events.PropagationEvent[]["click"]
visibleWhether to show or hidebooleantrue