Dialog

Dialogs inform users about a task and can contain critical information, require decisions, or involve multiple tasks.

Basic Usage

By default, dialog will transform from the click position. It scales up from 0.8 considering the transition shouldn’t be too drastic:

import Spross from 'spross';
// false
const [visible, setVisible] = useState(false);
<Spross.Dialog visible={visible} onVisibleChange={setVisible} />

Auto Scale

use autoScale to automatically scale when the window is too small or large.

set true to enable auto scaling, set autoScaleRange to define the size range admitted for scaling, the default range is [0.9, 1]:

import Spross from 'spross';
// false
const [visible, setVisible] = useState(false);
<Spross.Dialog visible={visible} onVisibleChange={setVisible} />

API

PropsDescriptionTypeDefault
visibleWhether to show the dialogbooleanundefined
onVisibleChangeCallback function when the dialog display status changesfunctionundefined
originAwareWhether to show the dialog based on the click positionbooleantrue
autoScaleWhether to automatically scale the dialogbooleantrue
autoScaleRangeThe range of the dialog contentarray[0.75, 1]
childrenThe content of the dialogReact.ReactNodeundefined
classNameThe class name of the dialogstringundefined
styleThe style of the dialogReact.CSSPropertiesundefined
zIndexThe z-index of the dialognumberundefined