@igloo-ui/toaster
TypeScript icon, indicating that this package has built-in type declarations

2.2.0 • Public • Published

Toaster

The Toaster component is a non-disruptive message that appears at the top of the viewport to provide quick, at-a-glance feedback on the outcome of an action.

Installation

To install @igloo-ui/toaster in your project, you will need to run the following command using npm:

npm install @igloo-ui/toaster

If you prefer Yarn, use the following command instead:

yarn add @igloo-ui/toaster

Usage

Displaying a toast

Then to use the component in your code just import it!

import Toaster, { toast } from '@igloo-ui/toaster';
import Button from '@igloo-ui/button';

const App = () => {
  return (
    <div>
      <Button onClick={() => toast.success('Successfully toasted!')}>
        Success
      </Button>

      <Toaster />
    </div>
  );
};

Displaying multiple toasts with custom duration

Then to use the component in your code just import it!

import Toaster, { toast } from '@igloo-ui/toaster';
import Button from '@igloo-ui/button';

const App = () => {
  return (
    <div>
      <Button onClick={() => toast.success('Successfully toasted!', {duration: 6000})}>
        Success
      </Button>
      <Button
        appearance="secondary"
        onClick={() => toast.error("This didn't work!", {duration: 3000}))}
      >
        Error
      </Button>

      <Toaster />
    </div>
  );
};

/@igloo-ui/toaster/

    Package Sidebar

    Install

    npm i @igloo-ui/toaster

    Weekly Downloads

    276

    Version

    2.2.0

    License

    Apache-2.0

    Unpacked Size

    1.68 MB

    Total Files

    9

    Last publish

    Collaborators

    • infra.admin
    • franckgaudin