0.2.1 • Published 2 years ago
@migueleraso/alerts_components v0.2.1
Alerts and toasts for javascript
demos: https://migueldavideraso.github.io/demos/alerts_components/
import { useToast, useAlert } from '@migueleraso/alerts_components'
const successToast = useToast({
defaultMessage: 'Success',
// type: success, info, warning, danger, dark, light
type: 'success',
duration: 3000, // default 5000
// positions: top-left, top-right, bottom-right, bottom-left
position: 'bottom-left',
dismissable: true,
onDismiss: (args) => {
console.log(args)
}
})
successToast('Success toast')
window.useAlert = async () => {
const result = await useAlert({
message: 'This is an alert',
accept: 'Accept',
cancel: 'Cancel',
// showCancelButton: false, // Confirm
/*
// Prompt
inputs: [
{
label: 'Name',
name: 'name',
type: 'text',
placeholder: 'Enter your name'
},
{
label: 'Age',
name: 'age',
type: 'number',
placeholder: 'Enter your age'
},
{
type: 'textarea'
}
]
*/
})
console.log(result)
}