Info

Info is a type of toast which represents some kind information.

Syntax

Typescript
1info(msg, options);
1info(msg, options);

Parameters

  • msg: Any valid message string value to display on toast.
  • options: Options is a javascript object used to add additional information & customization options.
    • title: Any valid title string value show at the top of toast.
    • icon: Any string, emoji, image, svg or jsx element to show at the place of icon.
    • style: Any valid CSS property to apply on toast.
    • toastDuration: Any valid number between 1-15.

Usage

Just import usePings hook into any compenent and your compenent is now ready to produce toasts.

Typescript
1import { usePings } from "react-pings";
2
3const MyComponent = () => {
4 const ping = usePings();
5
6 const showToast = () => {
7 ping.info("Toast Message", {
8 // options
9 });
10 };
11
12 return <button onClick={showToast}>Show Toast</button>;
13};
1import { usePings } from "react-pings";
2
3const MyComponent = () => {
4 const ping = usePings();
5
6 const showToast = () => {
7 ping.info("Toast Message", {
8 // options
9 });
10 };
11
12 return <button onClick={showToast}>Show Toast</button>;
13};