1.0.84 • Published 5 months ago

inaipi-toast v1.0.84

Weekly downloads
-
License
MIT
Repository
-
Last release
5 months ago

inaipi-toast

inaipi-toast is a simple and customizable toast notification library for React applications. It allows you to easily display success, warning, and error messages in a variety of positions.

Installation

To install inaipi-toast, run the following command:

npm install inaipi-toast --legacy-peer-deps

Usage

Import the Library

To use the inaipi-toast library, import it into your React component like this:

import { toast } from 'inaipi-toast';

Example

Here is a basic example of how to use the toast notifications in your React component:

import { toast } from 'inaipi-toast';
import React from 'react';

const App = () => {
  // Handler functions for each type of toast
  const showSuccessToast = () => {
    toast.success("Success", "This is a success message!", { position: "bottom-left" });
  };

  const showWarningToast = () => {
    toast.warning("Warning", "This is a warning message!", { position: "top-left" });
  };

  const showErrorToast = () => {
    toast.error("Error", "This is an error message!");
  };

  return (
    <div style={{ padding: '20px' }}>
      <h2>Toast Notifications</h2>

      {/* Button to trigger success toast */}
      <button onClick={showSuccessToast} style={{ margin: '10px', padding: '10px' }}>
        Show Success Toast
      </button>

      {/* Button to trigger warning toast */}
      <button onClick={showWarningToast} style={{ margin: '10px', padding: '10px' }}>
        Show Warning Toast
      </button>

      {/* Button to trigger error toast */}
      <button onClick={showErrorToast} style={{ margin: '10px', padding: '10px' }}>
        Show Error Toast
      </button>
    </div>
  );
};

export default App;

Toast Types

inaipi-toast supports the following types of toast notifications:

  • Success: For success messages
    toast.success("Success", "This is a success message!", { position: "bottom-left" });
  • Warning: For warning messages
    toast.warning("Warning", "This is a warning message!", { position: "top-left" });
  • Error: For error messages
    toast.error("Error", "This is an error message!");

Options

You can customize the position of your toast using the position option. The available positions are:

  • "top-left"
  • "top-right"
  • "bottom-left"
  • "bottom-right"

Example:

toast.success("Success", "This is a success message!", { position: "top-center" });

Customization

inaipi-toast is designed to be flexible, allowing you to customize the appearance and behavior as needed. You can customize things like the duration of the toast, animation styles, and more by modifying the options object.

License

inaipi-toast is licensed under the MIT License.

1.0.84

5 months ago

1.0.80

5 months ago

1.0.79

5 months ago

1.0.78

5 months ago

1.0.77

5 months ago

1.0.76

5 months ago

1.0.75

5 months ago

1.0.74

5 months ago

1.0.73

5 months ago

1.0.72

5 months ago

1.0.71

5 months ago

1.0.70

5 months ago

1.0.69

5 months ago

1.0.68

5 months ago

1.0.67

5 months ago

1.0.66

5 months ago

1.0.65

5 months ago

1.0.64

5 months ago

1.0.63

5 months ago

1.0.62

5 months ago

1.0.61

5 months ago

1.0.60

5 months ago

1.0.59

5 months ago

1.0.56

5 months ago

1.0.51

5 months ago

1.0.50

5 months ago

1.0.49

5 months ago

1.0.48

5 months ago

1.0.47

5 months ago

1.0.45

5 months ago

1.0.44

5 months ago

1.0.43

5 months ago

1.0.42

5 months ago

1.0.41

5 months ago

1.0.40

5 months ago

1.0.39

5 months ago

1.0.38

5 months ago

1.0.37

5 months ago

1.0.36

5 months ago

1.0.35

5 months ago

1.0.34

5 months ago

1.0.33

5 months ago

1.0.32

5 months ago

1.0.31

5 months ago

1.0.30

5 months ago

1.0.29

5 months ago

1.0.27

5 months ago

1.0.26

5 months ago

1.0.25

5 months ago

1.0.24

5 months ago

1.0.23

5 months ago

1.0.22

5 months ago

1.0.21

5 months ago

1.0.20

5 months ago

1.0.19

5 months ago

1.0.18

5 months ago

1.0.17

5 months ago

1.0.16

5 months ago

1.0.15

5 months ago

1.0.13

5 months ago

1.0.12

5 months ago

1.0.11

5 months ago

1.0.10

5 months ago

1.0.9

5 months ago

1.0.8

5 months ago

1.0.7

5 months ago

1.0.6

5 months ago

1.0.5

5 months ago

1.0.4

5 months ago

1.0.3

5 months ago

1.0.2

5 months ago

1.0.1

5 months ago

1.0.0

5 months ago