Dialogs inform users about a task and can contain critical information, require decisions, or involve multiple tasks.
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';// falseconst [visible, setVisible] = useState(false);<Spross.Dialog visible={visible} onVisibleChange={setVisible} />
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';// falseconst [visible, setVisible] = useState(false);<Spross.Dialog visible={visible} onVisibleChange={setVisible} />
Props | Description | Type | Default |
---|---|---|---|
visible | Whether to show the dialog | boolean | undefined |
onVisibleChange | Callback function when the dialog display status changes | function | undefined |
originAware | Whether to show the dialog based on the click position | boolean | true |
autoScale | Whether to automatically scale the dialog | boolean | true |
autoScaleRange | The range of the dialog content | array | [0.75, 1] |
children | The content of the dialog | React.ReactNode | undefined |
className | The class name of the dialog | string | undefined |
style | The style of the dialog | React.CSSProperties | undefined |
zIndex | The z-index of the dialog | number | undefined |