@migueleraso/alerts_components

0.2.1 • Public • Published

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)
}

Readme

Keywords

none

Package Sidebar

Install

npm i @migueleraso/alerts_components

Weekly Downloads

0

Version

0.2.1

License

ISC

Unpacked Size

18 kB

Total Files

3

Last publish

Collaborators

  • migueleraso