Module @tokene/toasts

@tokene/toasts

These packages aim to provide developers with a set of commonly used components for building TokenE web applications.

version (scoped package) types tree-shaking checks

Getting Started

Installing

yarn add @tokene/toasts

Setup

import { ToastPlugin } from '@tokene/toasts'
import '@tokene/toasts/dist/index.css'

app.use(ToastPlugin)

usage

const { showTxToast, removeToast } = useNotifications()

lastToastId.value = showTxToast('pending', txLink!)

removeToast(lastToastId.value!)
showTxToast('success', txLink!)

Or

import { ToolkitBus } from '@tokene/toolkit'
import { useNotifications, type NotificationPayload } from '@tokene/toasts'

const { showToast } = useNotifications()

ToolkitBus.on(Bus.eventList.success, payload =>
showToast('success', payload as NotificationPayload),
)
ToolkitBus.on(Bus.eventList.warning, payload =>
showToast('error', payload as NotificationPayload),
)
ToolkitBus.on(Bus.eventList.error, payload =>
showToast('warning', payload as NotificationPayload),
)
ToolkitBus.on(Bus.eventList.info, payload =>
showToast('info', payload as NotificationPayload),
)
ToolkitBus.on(Bus.eventList.default, payload =>
showToast('default', payload as NotificationPayload),
)

License

This project is licensed under the MIT License - see the LICENSE.md file for details

Index

Variables

Generated using TypeDoc