MsgBox
import {MsgBox} from 'cx/widgets';The MsgBox class provides utility methods for displaying alerts and confirmation windows.
Both alert and yesNo methods accept either just a message string, or a configuration object, with the following properties:
message- message string,title- window title (string),header- window header (Cx component),itemsorchildren- list of child elements (for rich content),store- store to be used in the new Window instance,style- window style,yesText- customyestext, default value:Yes,noText- customnotext, default value:No,okText- customOKtext, default value:OK.
<Button
onClick={() => {
MsgBox.alert({ message: 'This is an alert!', title: 'Title' })
}}
>
Alert
</Button>
<Button
onClick={() => {
MsgBox
.yesNo({ message: 'Would you like to see another alert?', yesText: "Yes, please", noText: "No, thanks" })
.then((btn) => {
if (btn == 'yes')
MsgBox.alert('Here it is.')
});
}}
>
Custom Yes or No
</Button>| Methods |
|---|
MsgBox.alert(options)Displays an alert window. The |
MsgBox.yesNo(options)Displays a confirmation window with two options (yes and no).
|
In case you need to display rich content such as links or images inside the message box, pass it through
childreninstead ofmessage.