yarn add @twilio-paste/alert-dialog - or - yarn add @twilio-paste/core
import {AlertDialog} from '@twilio-paste/core/alert-dialog';
import {Button} from '@twilio-paste/core/button';
const AlertDialogExample = () => {
const [isOpen, setIsOpen] = React.useState(false);
const handleOpen = () => setIsOpen(true);
const handleClose = () => setIsOpen(false);
return (
<div>
<Button variant="primary" onClick={handleOpen}>
Open alert dialog
</Button>
<AlertDialog
heading="Submit application"
isOpen={isOpen}
onConfirm={() => {}}
onConfirmLabel="Submit"
onDismiss={handleClose}
onDismissLabel="Cancel"
>
Are you sure you want to submit this application? No information can be changed after submitting.
</AlertDialog>
</div>
);
};
heading RequiredRequired
Header for the Alert Dialog
- Type
string
isOpen RequiredRequired
Determines whether the Alert Dialog is open
- Type
boolean
onConfirm RequiredRequired
Function to run when the confirm button is used
- Type
() => void
onConfirmLabel RequiredRequired
Label for the confirm button
- Type
string
onDismiss RequiredRequired
Function to run when the dismiss button is used
- Type
() => void
onDismissLabel RequiredRequired
Label for the dismiss button
- Type
string
destructive
Display a destructive Alert Dialog
- Type
boolean
element
Overrides the default element name to apply unique styles with the Customization Provider
- Type
any
- Default
'ALERT_DIALOG'
isConfirmDisabled
Disable the confirm button
- Type
boolean
onConfirmDisabled
Disable the confirm button. Use isConfirmDisabled
- Type
boolean
Inherited props
Paste components will often extend native HTML elements and as a result will inherit or extend their available properties. Below is a list of the props this component has inherited and are also available to use.