useAlert
The react hook for creating alerts and confirm alerts
Installation
import {useAlert} from 'uxp/components';Examples
alerts.show("Item updated")alerts.show({title: "Info", content: "Item updated", cancelButtonTitle: "Ok" })Auto close an alert (disabled by default)
alerts.show({content: 'Item updated', autoClose: true, closeAfter: 2000})wait until alert is closed
await alerts.show("Item updated")
... execute the restlet hasConfirmed = await alerts.confirm("Are you sure?")
if(hasConfimed) {
... execute the rest
}alerts.confirm("Are you sure?")
.then(hasConfirmed => {
if(hasConfirmed) {
... execute the rest
}
})Last updated