1.1.1 • Published 2 years ago

toast-noty v1.1.1

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

Toast Noty šŸš€

npm npm NPM Coveralls github

šŸŽ‰ Toast Noty - The next thing that pops on your screen! ✨

Installation

$ npm install --save toast-noty

Changelog

See the CHANGELOG.md file for a history of changes and updates.

Usage

Wrap your application in the ToastsProvider component like so:

<ToastsProvider>
    <Example />
</ToastsProvider>

The useToasts hook will provide you with createToast and removeToast and you can use them as shown below:

import { useToasts } from "hooks/useToasts";

export const Example = () => {
  const { createToast } = useToasts();

  return (
    <button
      onClick={() => createToast({
        type: "warning",
        title: "Achtung!",
        message:
          "There's something happening in your application that needs your attention āš ļø",
        duration: 3,
      })
      }
    >
      Toast Noty!
    </button>
  );
};

Documentation

createToast

Creates and displays a new toast with customizable properties.

ParameterDescriptionDefault Value
{ id, type, title, message, duration }An object containing the toast properties.
id(Optional) Custom 'id' to use for the notification.uuid
type(Optional) The type of the toast: 'warning', 'success', or 'danger'.'success'
title(Optional) The title of the toast.type
messageThe main message content of the toast.
duration(Optional) The duration (in seconds) the toast should be displayed.6

removeToast

Removes a toast with the specified id.

ParameterDescription
idThe unique identifier of the toast to be removed.

Demo

Contribute

Help this package reach more people by giving it a ⭐.

License

Licensed under MIT

1.1.1

2 years ago

1.1.0

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago